I'm having trouble with a StaticTriangleGroup throwing the following exception. This doesn't happen until contact has been made by another Entity. The STG is a simple 4x4 flat plane consisting of 25 vertices and 32 triangles. Any ideas? Thanks.
Object reference not set to an instance of an object.
at BEPUphysics.StaticTriangleGroup.addAllNecessaryTriangles()
at BEPUphysics.StaticTriangleGroup.updateBeforeCollisionDetection(Single dt, Single timeScale, Single timeSinceLastFrame)
at BEPUphysics.Space.updateBeforeCollisionDetectionUpdateables(Single dt, Single timeSinceLastFrame)
at BEPUphysics.Space.updateCCD(Single timeSinceLastFrame)
at BEPUphysics.Space.updateWithoutInternalTimeSteps(Single timeSinceLastFrame)
at BEPUphysics.Space.update(Single timeSinceLastFrame)
Exception in StaticTriangleGroup.addAllNecessaryTriangles()
Re: Exception in StaticTriangleGroup.addAllNecessaryTriangles()
This is likely caused by giving vertices to the StaticTriangleGroup's TriangleMesh which are not of the type StaticTriangleGroupVertex or a subclass. Passing in a superclass (like TriangleMeshVertex) will cause a cast to null in the add method. Using the StaticTriangleGroup's static getVerticesAndIndicesFromModel provides an easy way to get an array of the right type.
I plan to make this a little more forgiving/intuitive.
I plan to make this a little more forgiving/intuitive.
Re: Exception in StaticTriangleGroup.addAllNecessaryTriangles()
Yes, that's got to be it. I'm currently passing in an array of TriangleMeshVertex. I haven't tested it yet, but I'll make the switch to StaticTriangleGroupVertex. Thanks.Passing in a superclass (like TriangleMeshVertex) will cause a cast to null in the add method.