prettified convex composition demo (added concave version, next to convex hull and convex decomposition)
This commit is contained in:
@@ -46,6 +46,7 @@ subject to the following restrictions:
|
|||||||
|
|
||||||
|
|
||||||
btVector3 centroid;
|
btVector3 centroid;
|
||||||
|
btVector3 convexDecompositionObjectOffset(10,0,0);
|
||||||
|
|
||||||
#define CUBE_HALF_EXTENTS 4
|
#define CUBE_HALF_EXTENTS 4
|
||||||
|
|
||||||
@@ -258,10 +259,10 @@ void ConvexDecompositionDemo::initPhysics(const char* filename)
|
|||||||
|
|
||||||
m_convexDemo->m_collisionShapes.push_back(convexShape);
|
m_convexDemo->m_collisionShapes.push_back(convexShape);
|
||||||
|
|
||||||
|
|
||||||
btTransform trans;
|
btTransform trans;
|
||||||
trans.setIdentity();
|
trans.setIdentity();
|
||||||
trans.setOrigin(centroid);
|
trans.setOrigin(centroid-convexDecompositionObjectOffset);
|
||||||
|
|
||||||
//btRigidBody* body = m_convexDemo->localCreateRigidBody( mass, trans,convexShape);
|
//btRigidBody* body = m_convexDemo->localCreateRigidBody( mass, trans,convexShape);
|
||||||
m_convexDemo->localCreateRigidBody( mass, trans,convexShape);
|
m_convexDemo->localCreateRigidBody( mass, trans,convexShape);
|
||||||
mBaseCount+=result.mHullVcount; // advance the 'base index' counter.
|
mBaseCount+=result.mHullVcount; // advance the 'base index' counter.
|
||||||
@@ -307,10 +308,15 @@ void ConvexDecompositionDemo::initPhysics(const char* filename)
|
|||||||
|
|
||||||
btTransform startTransform;
|
btTransform startTransform;
|
||||||
startTransform.setIdentity();
|
startTransform.setIdentity();
|
||||||
startTransform.setOrigin(btVector3(20,2,0));
|
startTransform.setOrigin(btVector3(0,2,0));
|
||||||
|
|
||||||
localCreateRigidBody(mass, startTransform,convexShape);
|
localCreateRigidBody(mass, startTransform,convexShape);
|
||||||
|
|
||||||
|
bool useQuantization = true;
|
||||||
|
btCollisionShape* concaveShape = new btBvhTriangleMeshShape(trimesh,useQuantization);
|
||||||
|
startTransform.setOrigin(convexDecompositionObjectOffset);
|
||||||
|
localCreateRigidBody(0.f,startTransform,concaveShape);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user