I'm having some problems with the triangle entity. I initialize the triangle with three different points but when I query the triangle vertices in world space (by getting the properties VertexA, VertexB and VertexC) the VertexB and VertexC properties return the same value.
Basically I'm trying to spawn a triangle in the place of a Sphere. In the class holding the Sphere (note the different vertices):
Code: Select all
TriangleManager.AddTriangle(new Vector3(0, 0, 0), new Vector3(1, 1, 0), new Vector3(-1, 1, 0), SphereBody.WorldTransform);
Code: Select all
public void AddFragment(Vector3 v0, Vector3 v1, Vector3 v2, Matrix world) {
TriangleBody = new Triangle(v0, v1, v2, 0.01f) {
WorldTransform = world,
};
Space.Add(TriangleBody);
}
Code: Select all
VertexBuffer.Set(index++, Semantic.Position, TriangleBody.VertexA);
VertexBuffer.Set(index++, Semantic.Position, TriangleBody.VertexB);
VertexBuffer.Set(index++, Semantic.Position, TriangleBody.VertexC);
Code: Select all
if (fragment.VertexB == fragment.VertexC) {
throw new Exception("degenerate triangle"); // gets thrown
}
Edit:
BEPUphysics 1.2.0, SharpDX fork (commit 87fc56cc9ed4 - latest at time of writing)
Also I *think* the triangles still behave like triangles in terms of physics and raycasts (though that is really hard to say without correct visuals ^^)