• Advertisement

Archived

This topic is now archived and is closed to further replies.

Basic : Character Rotation tied to arrow keys

This topic is 5152 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a model character that i am trying to get to move around using the arrow keys. forward and back are working fine. for left and right, I want the character to rotate in either direction, and not strafe. I have the strafe working also. I am not tying the character rotataion to the mouse, only to keys I assume something like below should work, however I''m getting a wobble and unusal rotation....... Can anyone help thanks TURN_RATE = 10.00 vec3_t axis[3]; // x[][][] , y[][][], z[][][] // turn if (self->player->cmd.commands & PC_LEFT) self->player->axis[1] += TURN_RATE*self->car->deltatime*0.001f; if (self->player->cmd.commands & PC_RIGHT) self->player->axis[1] -= TURN_RATE*self->car->deltatime*0.001f;

Share this post


Link to post
Share on other sites
Advertisement
what you are doing is adding a scalar to axis[1] (???).

what you want to do is rotate your facing and right vectors around your up vector.

[edited by - Ghwerig on January 14, 2004 7:15:14 PM]

Share this post


Link to post
Share on other sites
Assuming you know what you''re doing with that code, the only explanation I can think of is if your variables are too different (in terms of powers, i.e. 0.01 vs. 1000), you might be having issues with float precision. Why do you have to multiply by 0.001f?

Share this post


Link to post
Share on other sites
I just started out with managed direct-x and found this page on character movement:

http://216.5.163.53/DirectX4VB/Tutorials/DirectX7/IM_Character.asp

Regards,
Robin

Share this post


Link to post
Share on other sites

  • Advertisement