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

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

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

Post by Yola » Fri Nov 23, 2018 4:09 pm

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: 50
Joined: Sun Nov 23, 2008 4:43 pm

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

Post by bram » Fri Nov 23, 2018 7:18 pm

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: 8
Joined: Wed Oct 24, 2018 8:38 am

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

Post by Yola » Sat Nov 24, 2018 7:55 pm

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
Compound fall through.
compound.gif (105.99 KiB) Viewed 273 times

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

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

Post by Yola » Tue Nov 27, 2018 8:57 am

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

Post Reply