Controlling the player with physics

esset

11-09-2010 19:12:27

I know, this question is very basic. But yes, i know how to program, and yes, i have read some of the PhysX tutorials as well as all the NxOgre tutorials. But I lack a LOT of experience when it comes to physics programming, and thats why i cant answer this hopefully simple question.

<ramble>
I want to control the player in an FPS game using physics. I want the actor that drives the player to have a short time of acceleration before it reaches desired movement speed. So i presume ill have to use force. However, i have no idea what shape my actor should have nor how i should apply that force. Currently the player is a sphere that receives a force based on what keys the player are pressing. However, the force is applied in world space, so no matter in what direction the player is facing, the sphere always travels in world -z when w is pressed, etc. I tried the probably more correct solution by applying local force, but i didn't account for orientation in the x-axis, so sometimes the local force that was supposed to push the player in the direction he was facing pushed the player straight down since his actor's x-axis had turned 90 degrees.
</ramble>

Im just very lost and even the slightest hint of what i should do would help me tremendously.

jarwulf

29-09-2010 21:27:24

I know, this question is very basic. But yes, i know how to program, and yes, i have read some of the PhysX tutorials as well as all the NxOgre tutorials. But I lack a LOT of experience when it comes to physics programming, and thats why i cant answer this hopefully simple question.

<ramble>
I want to control the player in an FPS game using physics. I want the actor that drives the player to have a short time of acceleration before it reaches desired movement speed. So i presume ill have to use force. However, i have no idea what shape my actor should have nor how i should apply that force. Currently the player is a sphere that receives a force based on what keys the player are pressing. However, the force is applied in world space, so no matter in what direction the player is facing, the sphere always travels in world -z when w is pressed, etc. I tried the probably more correct solution by applying local force, but i didn't account for orientation in the x-axis, so sometimes the local force that was supposed to push the player in the direction he was facing pushed the player straight down since his actor's x-axis had turned 90 degrees.
</ramble>

Im just very lost and even the slightest hint of what i should do would help me tremendously.



I found using forces to move a player object in Nxogre to be very frustrating I ended up settling for using the set velocity functions.