public virtual void Initialize(ref IndexedVector3 from, ref IndexedVector3 to, RayResultCallback resultCallback, CollisionObject collisionObject, TriangleMeshShape triangleMesh, ref IndexedMatrix colObjWorldTransform) { base.Initialize(ref from, ref to, resultCallback.m_flags); m_resultCallback = resultCallback; m_collisionObject = collisionObject; m_triangleMesh = triangleMesh; m_colObjWorldTransform = colObjWorldTransform; }
public BridgeTriangleRaycastCallback() { } // for pool public BridgeTriangleRaycastCallback(ref IndexedVector3 from, ref IndexedVector3 to, RayResultCallback resultCallback, CollisionObject collisionObject, TriangleMeshShape triangleMesh, ref IndexedMatrix colObjWorldTransform) : base(ref from, ref to, resultCallback.m_flags) { //@BP Mod m_resultCallback = resultCallback; m_collisionObject = collisionObject; m_triangleMesh = triangleMesh; m_colObjWorldTransform = colObjWorldTransform; }
public static CollisionShape BuildCorner(IndexedVector3[] vertices, int[] indices) { int vertStride = 1; int indexStride = 3; ObjectArray<IndexedVector3> vertexArray = new ObjectArray<IndexedVector3>(); for (int i = 0; i < vertices.Length; ++i) { vertexArray.Add(vertices[i]); } ObjectArray<int> intArray = new ObjectArray<int>(); for (int i = 0; i < indices.Length; ++i) { intArray.Add(indices[i]); } TriangleIndexVertexArray indexVertexArray = new TriangleIndexVertexArray(indices.Length / 3, intArray, indexStride, vertexArray.Count, vertexArray, vertStride); TriangleMeshShape triangleMesh = new TriangleMeshShape(indexVertexArray); return triangleMesh; }
public CollisionShape BuildCorner() { // slope. IndexedVector3[] vertices = new IndexedVector3[]{new IndexedVector3(0,0,0),new IndexedVector3(1,0,0),new IndexedVector3(0,0,1),new IndexedVector3(1,0,1), new IndexedVector3(0,1,0),new IndexedVector3(1,1,0),new IndexedVector3(0,1,1),new IndexedVector3(1,1,1)}; //int[] indices = new int[] { 0, 4, 5, 4, 6, 7, 7, 5, 4, 0, 4, 6, 6, 2, 0, 2, 6, 7, 4,5,0,2,2,7,5}; //int[] indices = new int[] { 0, 4, 5, 4, 6, 7, 7, 5, 4, 6, 4,0,0,2,6, 7, 6, 2, 4, 5, 0, 2, 2, 7, 5 }; int[] indices = new int[] { 1,4,5, 1,5,7, 7,3,1, 3,7,6, 7,5,4, 4,6,7, 4,1,3, 3,6,4 }; int vertStride = 1; int indexStride = 3; ObjectArray<IndexedVector3> vertexArray = new ObjectArray<IndexedVector3>(); for (int i = 0; i < vertices.Length; ++i) { vertexArray.Add(vertices[i]); } ObjectArray<int> intArray = new ObjectArray<int>(); for (int i = 0; i < indices.Length; ++i) { intArray.Add(indices[i]); } TriangleIndexVertexArray indexVertexArray = new TriangleIndexVertexArray(indices.Length/3, intArray, indexStride, vertexArray.Count, vertexArray, vertStride); TriangleMeshShape triangleMesh = new TriangleMeshShape(indexVertexArray); //TriangleMeshShape triangleMesh = new BvhTriangleMeshShape(indexVertexArray,true,true); return triangleMesh; }
CollisionShape BuildLargeMesh() { //int vertStride = sizeof(IndexedVector3); //int indexStride = 3*sizeof(int); int vertStride = 1; int indexStride = 3; ObjectArray<IndexedVector3> vertexArray = new ObjectArray<IndexedVector3>(); for (int i = 0; i < vertices.Length; ++i) { vertexArray.Add(vertices[i]); } ObjectArray<int> intArray = new ObjectArray<int>(); for (int i = 0; i < indices.Length; ++i) { intArray.Add(indices[i]); } //TriangleIndexVertexArray indexVertexArray = new TriangleIndexVertexArray(DemoMeshes.BUNNY_NUM_TRIANGLES, DemoMeshes.gBunnyIndices, 3, DemoMeshes.BUNNY_NUM_VERTICES, DemoMeshes.gBunnyVertices, 3); TriangleIndexVertexArray indexVertexArray = new TriangleIndexVertexArray(numTriangles, intArray, indexStride, vertexArray.Count, vertexArray, vertStride); TriangleMeshShape triangleMesh = new TriangleMeshShape(indexVertexArray); //TriangleMeshShape triangleMesh = new BvhTriangleMeshShape(indexVertexArray,true,true); return triangleMesh; }