a problem with move a body

cakecake

30-07-2009 10:36:29

I just begin use NxGore a few days ago.
I create a body and use fuction addForce() to move it,and problems comes.Yes,it moved, but with rotating. why? I just want it move horizontally.

Here is my code:

OGRE3DBody* mrobot=mRenderSystem->createBody(new NxOgre::Box(1, 1, 1), NxOgre::Real3(10, 0, 30), "robot.mesh");
mBody->addForce(NxOgre::Real3(10,0,0),NxOgre::Enums::ForceMode_Impulse);


I use NxOgre 1.5.4, Ogre 1.6.2,physx2.8.1

Another question:
How should I change direction the body move toward,which fuction should I use?

Thank all.

nargil

30-07-2009 11:23:32

You add an impulse force. Imagine you kick a box. It WILL rotate. What you may want to try is adding a smaller continuos force each frame. And as I see robot.mesh I think you want to create a player/npc character ? It's not done that way (rigid bodies). Use physyx character system.

cakecake

30-07-2009 11:38:17

You add an impulse force. Imagine you kick a box. It WILL rotate. What you may want to try is adding a smaller continuos force each frame. And as I see robot.mesh I think you want to create a player/npc character ? It's not done that way (rigid bodies). Use physyx character system.

What a quick reply!thanks~
It seems that I have to use Physx.