Quantcast
Channel: Question and Answer » libgdx
Viewing all articles
Browse latest Browse all 434

Bullet Collision Shape doesn't wrap Model correctly

$
0
0

i got an object called human and an object called platform.

I simply let the human fall down on the platform with a constant speed. No acceleration!

The problem is that my collision shapes for both (i use btBoxShape to keep it simple) objects are not wrapping the associated object accordingly:

enter image description here
i scaled it up in paint, sorry for the bad resolution

I got this result calculating the bounds for the model, retrieve the dimensions and the center and then i create a btBoxShape with half of the dimensions and add it to the collisionObject:

box = new BoundingBox();
this.calculateBoundingBox(box);
box.getCenter(center);
box.getDimensions(dimensions);
collisionObject = new btCollisionObject();
boxShape = new btBoxShape(dimensions.sub(dimensions.x/2f, dimensions.y/2f, dimensions.z/2f));
collisionObject.setCollisionShape(boxShape);

And then i set the worldTransforms of the collisionObject to the transform of the object to be drawn(for instance human):

instances.get(0).collisionObject.setWorldTransform(instances.get(0).transform);

So how can i make the collisionShape wrap model?

This is the human in Blender:

enter image description here

I appreciate any help.

Thanks in advance


Viewing all articles
Browse latest Browse all 434

Trending Articles