Compound shape rigid body doesn't collide, obey gravity, ..

Yola
Posts: 10
Joined: Wed Oct 24, 2018 8:38 am

Compound shape rigid body doesn't collide, obey gravity, ..

Post by Yola »

I created compound shape rigid body. All other objects collide well, this one doesn't. But it falls through other objects due to gravity, strangely that other forces which i apply (tried ApplyCentralForce) doesn't affect it, but ApplyCentralImpulse affects it. What can it be? I use BulletSharp.
bram
Posts: 51
Joined: Sun Nov 23, 2008 4:43 pm

Re: Compound shape rigid body doesn't collide, obey gravity, ..

Post by bram »

Are you sure you added the body to the world with addRigidBody() call?

The sequence is:

- create btCompoundShape
- create child shapes, and add them with addChildShape()
- create btRigidBody with the compound shape as its shape.
- add the rigid body to your world.
Yola
Posts: 10
Joined: Wed Oct 24, 2018 8:38 am

Re: Compound shape rigid body doesn't collide, obey gravity, ..

Post by Yola »

I tried few things at home with bullet, so i tried to do the same at home with my C++ library. I do it like this:

Code: Select all

btVector3 boxDims(.5f, .5f, .5f);
auto compoundTransform = OrthogonalTransform::MakeTranslation(0, 5, 0);
auto compoundShape = make_unique<btCompoundShape>();
compoundShape->addChildShape(Tobt(compoundTransform), new btBoxShape(boxDims));
auto bodyCompound = CreateRigidBody(_dynamicsWorld.get(), compoundShape.get(), 5., Tobt(compoundTransform));
CreateRigidBody works for other types of rigid bodies. It adds to the world.
compound.gif
You do not have the required permissions to view the files attached to this post.
Yola
Posts: 10
Joined: Wed Oct 24, 2018 8:38 am

Re: Compound shape rigid body doesn't collide, obey gravity, ..

Post by Yola »

I believe i have found the error, i misused child transforms.