Collision Body not moving with object

abhinavxrai

26-03-2006 07:53:52

I have an object (say a cylinder) that I create and I have assigned a collision body to it. Now I pass the node to this cylinder through the frame listender constructor so it is available in the framelistener class.

Now, I put a few user input movements to move the cylinder around.

While viewing the debugging lines (F3 pressed), I can see the collision body being created but when I move the cylinder around, the collision body (i.e. the lines) do not move. They remain locked at the initial position of the cylinder. How can this problem be resolved? What am I doing wrong?

BergBoy

26-03-2006 11:44:54

Are you moving the physics body or the Ogre entity? If you move the physics body (with forces or by setting its position) it moves the node and thus the entity. it doesnt work the other way around (I had lots of pain with this). You should also move things with forces, not just translate objects. Physics doesnt work taht way. Theres a lot of info here or at the newton forums on how to move objects with forces. Have fun

abhinavxrai

26-03-2006 12:28:12

Oh crap! Now I understand. Well I am just trying to translate an Ogre Entity. So I guess thats why the collision body isnt moving. So the Newton world doesnt work with human contolled simple translation?

BergBoy

26-03-2006 13:09:46

No, translation is not such a great idea. It can be faked tho with the newton world. I posted a few days ago about 'inverse dynamics' that will let you apply forces to translate around (but it will still interact with the world).