danoli3
07-10-2009 11:47:29
Hello,
At the moment I'm trying to move my actor (OGRE3DBody) by:
For the walkDirection vector I am using the current direction the player is facing
When I use the above code the Actor moves at the slowest speed in the direction.
I overcame this by multiplying the vector like this:
I am not sure if this was the right thing to do, however it worked.
I had my character moving in the direction at a speed.
However more recently when debugging the movement system in a multi player environment I have noticed that this system is dependant on FPS and not on Time so every player had different movement speeds depenant on the FPS of that player.
This is not a desired outcome. Lol.
Please any help with this would be appreciated so much.
Am I using the right system? setLinearVelocity seems to work for player movement however is there a way to set a velocity that is constant and base it off time not Frame Rate?
I also have read this: viewtopic.php?f=6&t=8293&start=0 however OGRE3DBody uses an Actor not a Kinematic Actor so that solution doesn't help.
Thanks
At the moment I'm trying to move my actor (OGRE3DBody) by:
physicsBody->setLinearVelocity( NxOgre::Functions::XYZ<Ogre::Vector3, NxOgre::Vec3>( walkDirection ));
For the walkDirection vector I am using the current direction the player is facing
When I use the above code the Actor moves at the slowest speed in the direction.
I overcame this by multiplying the vector like this:
// Physics Code
Vector2 direction = this->getFacing(); // Get direction that the mesh is facing
float velocityY = physicsBody->getLinearVelocity().y; // Get linear velocity from the Y axis (so gravity still applies)
direction.x = direction.x * walkSpeed; // multiply direction by walkSpeed ( value of 86 )
direction.y = direction.y * walkSpeed;
// Get Y axis velocity (so our actor is effected by gravity when moving
walkDirection = Ogre::Vector3(direction.x , velocityY, direction.y);
physicsBody->setLinearVelocity( NxOgre::Functions::XYZ<Ogre::Vector3, NxOgre::Vec3>( walkDirection ));
I am not sure if this was the right thing to do, however it worked.
I had my character moving in the direction at a speed.
However more recently when debugging the movement system in a multi player environment I have noticed that this system is dependant on FPS and not on Time so every player had different movement speeds depenant on the FPS of that player.
This is not a desired outcome. Lol.
Please any help with this would be appreciated so much.
Am I using the right system? setLinearVelocity seems to work for player movement however is there a way to set a velocity that is constant and base it off time not Frame Rate?
I also have read this: viewtopic.php?f=6&t=8293&start=0 however OGRE3DBody uses an Actor not a Kinematic Actor so that solution doesn't help.
Thanks
