Jump to content

View more

Image of the Day

The night is still, but the invasion brings chaos. #screenshotsaturday #hanako #indiegame #gameart #ue4 #samurai https://t.co/cgILXuokoS
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

3D Rotation Formulas

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
2 replies to this topic

#1 acw83   Members   

174
Like
Likes
Like

Posted 15 December 1999 - 02:03 PM

Matrices really just confuse me. So, does anyone have the straight up equations to rotate a point around the x, y, and z axis? This is my ultimate goal:

BOOL RotatePoint(CVector* point, float xa, float ya, float za);
{
point.screen_x = // Rotated x around xa, ya, and xa.
point.screen_y = // Same as above but for y
point.screen_z = // Ditto

return TRUE;
}

Any help would be great! Thanks!


#2 Dave Astle   Distinguished Rhino   

2312
Like
Likes
Like

Posted 15 December 1999 - 12:38 PM

The equations are pretty trivial, and you should be able to derive them yourself with a little trig. BUT, since I'm nice, I'll give them to you.

For rotation around the z-axis:

x' = x cos za - y sin za;
y' = x sin za + y cos za;

For rotation around the x-axis:

y' = y cos xa - z sin xa;
z' = y sin xa + cos xa;

For rotation around the y-axis:

x' = x cos ya + z sin ya;
z' = - x sin ya + z cos ya;

Of course, x', y' and z' are the new coordinates. I'll let you figure out how to plug this into your code. It's not hard, but not as simple as you hoped.


#3 acw83   Members   

174
Like
Likes
Like

Posted 15 December 1999 - 02:03 PM

Thanks, you are the man. That was exactly what I was looking for!




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.