Skip to main content
gamedev.net
🔒 Locked

direction from angles

Started by travis08 4 replies 750+ views
Original Post
travis08
travis08
The should be a simple one. I've got a: a unit vector pointing -1 down Y and b: three xyz rotation angles. I want to rotate my initialized vector by the three angles, resulting in a new direction.
Zakwayda
Zakwayda
Quote:
Original post by travis08
The should be a simple one.

I've got a: a unit vector pointing -1 down Y
and b: three xyz rotation angles.

I want to rotate my initialized vector by the three angles, resulting in a new direction.
1. Build a rotation matrix from the Euler angles

2. Apply the rotation matrix to the vector (0, -1, 0)

Note that if the input vector is a cardinal basis vector (which it is in your case), you can simply extract the desired direction vector directly from the matrix.

Post back if you need more details.
travis08
travis08
jyk, thanks for the reply.
Just so I'm clear: I am building a rot matrix from the angles, after which I am simply multiplying/transforming my initialized vector by the matrix?

I'm testing this and am getting something close to what I want, but not quite. Want to make sure I'm understanding correctly.

Zakwayda
Zakwayda
Quote:
Just so I'm clear: I am building a rot matrix from the angles, after which I am simply multiplying/transforming my initialized vector by the matrix?
That's correct.
Quote:
I'm testing this and am getting something close to what I want, but not quite. Want to make sure I'm understanding correctly.
Can you describe the problems you're seeing? In what way are the results incorrect?

There are a number of places that errors could be introduced (for example, missing or misplaced degree/radian conversions, using the wrong vector notation, discrepancies in Euler-angle order, etc.). If you really get stuck, you might post some code.
travis08
travis08
Good point about the possible degree/radian issue. That sounds like what might be happening. I will play with this more tonight and post feedback, thanks.
travis08
travis08
After a degree to radian conversion all is well. Thanks very much jyk, I really appreciate the help.


Quote:
Original post by jyk
Quote:
Just so I'm clear: I am building a rot matrix from the angles, after which I am simply multiplying/transforming my initialized vector by the matrix?
That's correct.
Quote:
I'm testing this and am getting something close to what I want, but not quite. Want to make sure I'm understanding correctly.
Can you describe the problems you're seeing? In what way are the results incorrect?

There are a number of places that errors could be introduced (for example, missing or misplaced degree/radian conversions, using the wrong vector notation, discrepancies in Euler-angle order, etc.). If you really get stuck, you might post some code.


Topic Locked

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

Sign in to reply to this topic.