Jump to content
• ### What is your GameDev Story?

• Advertisement

Public Group

#### Archived

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

# Basic : Character Rotation tied to arrow keys

This topic is 5486 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

##### 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

##### 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

##### 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

##### Share on other sites

• Advertisement
• Advertisement
• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

(You must login to your GameDev.net account.)

• ### Popular Now

• 9
• 31
• 16
• 11
• 10
• Advertisement
• ### Forum Statistics

• Total Topics
634118
• Total Posts
3015609
×

## Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!