deshan
26-09-2009 06:38:16
Hi all,
I want to move my first person character to move. Up to now what I have done was when key pressed I apply a force or LinearVelocity on the OGRE3DBody. I am not sure what is better out of orce and LinearVelocity. Following is my code
The problem is character stops after some time because of the friction. Now I want apply the force or velocity continuously until the key released. I need to know how you people manage to handle that problem? Could you please tell me how you made your first person camera character with physics applying to it?
Thank You
I want to move my first person character to move. Up to now what I have done was when key pressed I apply a force or LinearVelocity on the OGRE3DBody. I am not sure what is better out of orce and LinearVelocity. Following is my code
//--In FPCamera class
void FPCamera::FPCForward()
{
cam_body->setLinearVelocity(NxOgre::Vec3(0, 0, -100));
//cam_body->addForce(NxOgre::Vec3(0, 0, -1000), NxOgre::Enums::ForceMode_Force);
}
//--In Framelistner class
bool FPCFrameListener::keyPressed(const OIS::KeyEvent &e)
{
switch (e.key)
{
case OIS::KC_UP:
case OIS::KC_W:
fpCamera->FPCForward();
break;
.....
}
The problem is character stops after some time because of the friction. Now I want apply the force or velocity continuously until the key released. I need to know how you people manage to handle that problem? Could you please tell me how you made your first person camera character with physics applying to it?
Thank You