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

Finding the forward vector

Started by Rohithzhere Jan 3, 2009 at 12:42 PM 0 replies 650+ views
Original Post
Rohithzhere
Rohithzhere
I was reading a few math books and i came across a snippet where the following lines of pseudo code were used to find the lookAt vector(The forward direction) Here it is.. X_Orientation = -Sin(Heading); Y_Orientation = cos(Heading); Z = 0; FinalX_position = CurrentPosition_X+X_Orientation*SomeFactor (Like 30 ,40 or 50); FinalY_position = CurrentPosition_Y+Y_Orientation*SomeFactor (Like 30 ,40 or 50); Final_Z = CurrentPosition_Z; The co-ordinate system used is Z Axis is height and Y axis is depth... (FinalX_position ,FinalY_position ,FinalZ ) will get transalated governed by the variable "SomeFactor". But i havent understood this fully ...Why do we need -Sin,+Cos....??? Could any1 kindly explain this to me in detail?..plz Are there better ways of doing this?? Thanks in anticipation
Thanks and Regards,Rohith.H.N
AndreiVictor
AndreiVictor
Do you have direct access to the 3D Transform matrix of the entity? If so, you can simply acquire it by getting the X-axis vector (assuming that's your forward) from the matrix.

refer: http://www.gamedev.net/reference/articles/article695.asp
c",)

Topic Locked

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

Sign in to reply to this topic.