Compound shape rigid body doesn't collide, obey gravity, ..
-
- Posts: 10
- Joined: Wed Oct 24, 2018 8:38 am
Compound shape rigid body doesn't collide, obey gravity, ..
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.
-
- Posts: 51
- Joined: Sun Nov 23, 2008 4:43 pm
Re: Compound shape rigid body doesn't collide, obey gravity, ..
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.
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.
-
- Posts: 10
- Joined: Wed Oct 24, 2018 8:38 am
Re: Compound shape rigid body doesn't collide, obey gravity, ..
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:
CreateRigidBody works for other types of rigid bodies. It adds to the world.
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));
You do not have the required permissions to view the files attached to this post.
-
- Posts: 10
- Joined: Wed Oct 24, 2018 8:38 am
Re: Compound shape rigid body doesn't collide, obey gravity, ..
I believe i have found the error, i misused child transforms.