Creating btConvexHullShape

pjStyle
Posts: 4
Joined: Thu Feb 26, 2009 6:36 pm

Creating btConvexHullShape

Post by pjStyle »

Hey there,

I'm having a hard time figuring out which collision shapes to utilize in my game prototype. I have created a 3dsmax export script which collects all vertices from an object and exports them.

Now i want to create a collision shape using these vertices. I was under the impression the btConvexHullShape was capable of this. But when i tested it out using a few simple test values i get a weird output. Here is my test code:

Code: Select all

			
btScalar v[] = 
{	
-10.0f,0,10.0f,
10.0f, 0,  10.0f,			
10.0f, 0,  -10.0f,
-10.0f, 0, -10.0f 
};

btConvexHullShape* shape = new btConvexHullShape(v, 4);
btDefaultMotionState* motionState =	new btDefaultMotionState();
		
btRigidBody::btRigidBodyConstructionInfo cInfo(0, motionState, shape);
btRigidBody* body = new btRigidBody(cInfo);

m_world->addRigidBody(body);
What is it i am doing wrong? What i wanted to create here is a simple ground plane for my bos to land on, but in the proces i get something unexpected :D. Now my question is what shape should i be using to get my expected output?

Here is a screeshot of the convex hull using debug drawing. Note: the cube is located at 0,20,0 and i would expect a plane to be present underneath the cube in the origin.
Image
pjStyle
Posts: 4
Joined: Thu Feb 26, 2009 6:36 pm

Re: Creating btConvexHullShape

Post by pjStyle »

Please delete this message. It's been resolved already!

Thanks!