Skip to main content
GameDev.net gamedev.net
🔒 Locked 🎮 Unity

Vector transform, explanation

Started by woytah Apr 10, 2009 at 9:08 AM 1 replies 1.1k views
Original Post
woytah
woytah
Hello guys! I'm posting this message here, cause to show what I ask about, I will use OpenGL commands. But this topic is rather about Math... So... In OpenGL when we will call: glRotatef(90, 0,1,0); //90 deg around y axis glRotatef(90, 0,0,1); //90 deg around z axis glBegin(GL_LINES); glVertex3f(0,0,0); glVertex3f(1,0,0); glEnd(); We will see a vector drawn as (0,1,0). Now when we take the current transform matrix, and multiply vector (1,0,0) by this matrix, we will have the result of (0,0,1). My question is, why does it happen? Thank you for any help and explanatins! :D
Erik Rufelt
Erik Rufelt
Matrix-operations are executed from "right to left", that is the last one you do before you draw is actually executed first. So when you write like that, you will actually first rotate around the z-axis, to (0,1,0), then rotate that around the y-axis, which doesn't make a difference.
Try switching the order and you will see the other one.
woytah
woytah
Ohhh so that is how it works! Thank you very much for explanation! :)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.