Moving dynamic body

razer
Posts: 82
Joined: Sun Apr 04, 2010 10:08 pm

Moving dynamic body

Post by razer »

As I understand the only way to move dynamic body is to apply force or impulse. Is that correct?

I wish to move bodies and set velocity and torque my self every frame and then ask bullet what will happen in delta time (next frame).
Then I will move bodies to different locations and set different velocity and torque. (it would be different location, velocity and torque than bullet calculated)

Should I create world every frame? It would be expensive to add static bodies.

Should I remove dynamic bodies and add new dynamic bodies every frame?

Thanks
mako90
Posts: 28
Joined: Tue Jan 05, 2010 12:41 pm

Re: Moving dynamic body

Post by mako90 »

Hi,
I suppose, you should make something like this:

for body in bodies do:
body->setVelocity;
body->setTorque;
body->setImpulse;

btPhysics->stepSimulation;

for body in bodies do:
body->getVelocity;
body->getTorque;
body->getImpulse;
razer
Posts: 82
Joined: Sun Apr 04, 2010 10:08 pm

Re: Moving dynamic body

Post by razer »

It is possible to move objects using get/setWorldTransform methods