# World Movement

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

## Recommended Posts

Having an issue trying to use trig to calculate the x and z values when walking through my 3D world. Im trying to move the player in the direction they are looking. First problem im hving is i dont quiet understand the rotation system in OpenGL, i mean i thought if i stood in one point and rotated around the y axis until i returned to wat i was originally looked at it would be 360deg rotation, instead it appears to be numnerous revolutions? Any input here? To find the x and z co-ords im using this: cX += Math.sin(yRot) * 1; cZ += Math.cos(yRot) * 1; So im sure most of you can see this is horribly wrong. The result im getting is horrible lol. I would draw an image of my thinking but i dont think that will be needed, last time i neeed some help the replies i got were stunning, but if you would like me to post an image just ask :) Any help would be greatly appreciated, Cheers, Nick

##### Share on other sites
The problem is you are using degrees, sin cos and OpenGL all use radians.

##### Share on other sites
Grain's right about sin() and cos(), but OpenGL actually uses degrees. So you can send your angles as-is to glRotate(), but you'll need to convert them to radians before calling c++ trig functions.

##### Share on other sites
Thank you soo much lol that was my problem, i assumed OpenGL used radians also, but your correct it uses deg. Thanks for your help,

Cheers, Nick

• ### What is your GameDev Story?

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

• 13
• 9
• 15
• 14
• 46
• ### Forum Statistics

• Total Topics
634059
• Total Posts
3015292
×