compund shapes and constraints

eskimo456
Posts: 6
Joined: Wed Feb 15, 2012 3:26 pm

compund shapes and constraints

Post by eskimo456 »

Hi there

I am very new to this and am sorry if I ask some seemingly obvious questions. In order to create a constraint do you require a compoundShape? Or can a constraint be created with two rigid bodies?

If a compoundShape is required is it possible to then convert the compound shape to a rigidbody and vice-versa?

Many thanks
User avatar
Dr.Shepherd
Posts: 168
Joined: Tue Jan 04, 2011 11:47 pm

Re: compund shapes and constraints

Post by Dr.Shepherd »

eskimo456 wrote:Hi there

I am very new to this and am sorry if I ask some seemingly obvious questions. In order to create a constraint do you require a compoundShape? Or can a constraint be created with two rigid bodies?

If a compoundShape is required is it possible to then convert the compound shape to a rigidbody and vice-versa?

Many thanks
They are two separate things. A constraint can be created with two rigid/soft bodies.
eskimo456
Posts: 6
Joined: Wed Feb 15, 2012 3:26 pm

Re: compund shapes and constraints

Post by eskimo456 »

Hi again
I have been looking at implementing the Constraints demo tutorial using some primitive shapes to start. I am slightly confused as to how localCreateRigidBodyWorks. Does this automatically add the rigid body to the environment using the dynamicsWorld->addRigidbody() command?

The other thing I am slightly confused on is that the trans variable is used for both the d6body0 and the fixed rigid body. How would I then be able to draw the two rigid bodies in the correct place?

I am currently using the technique

Code: Select all

fallRigidBody->getMotionState()->getWorldTransform(trans);
trans.getOrigin().getX(),trans.getOrigin().getY(),trans.getOrigin().getZ()
This works fine for objects colliding and falling with gravity, however since the slider only uses the trans variable for both rigidBodies they are both placed in the same place (which makes sense). Do i need to use the frameInA and frameInB transformations to draw the objects in the correct position.

many thanks