Noob question about getting/setting position and orientation

Adaline
Posts: 5
Joined: Mon Feb 08, 2010 5:40 pm

Noob question about getting/setting position and orientation

Post by Adaline »

Hi,

I have to manage simple bodies represented by compound convex shapes.
I think I'm not using correctly motion states, the collisions are well detected, but responses are totally random

Here's what I do to get data :

Code: Select all

                        btTransform t;
			body->getMotionState()->getWorldTransform(t);
			btVector3 o=t.getOrigin();
			btQuaternion q=t.getRotation();
And for putting data :

Code: Select all

                                btTransform t;
				t.setIdentity();
				t.setOrigin(...);
				t.setRotation(...);
                                body->getMotionState()->setWorldTransform(t);
Has anybody get an idea ?

Thanks
User avatar
rewb0rn
Posts: 13
Joined: Tue Feb 02, 2010 11:48 pm
Location: Berlin, Germany

Re: Noob question about getting/setting position and orientation

Post by rewb0rn »

What you normally do not want to do in a physics engine is set orientations and positions directly because it will produce what you describe as random collision behavior. Instead you should apply forces or torque to achieve the desired behavior. Hope this helps.
Adaline
Posts: 5
Joined: Mon Feb 08, 2010 5:40 pm

Re: Noob question about getting/setting position and orientation

Post by Adaline »

In fact I 'put data' on object creation only.
I solved the pb : it came from local inertia wrongly initialized
Thank you for the answer :-)