29.11.2016, 17:12
I searched a lot on stack exchange and other coding sites, also on math related sites. But I just couldn't find what I needed.
So, what I want to do sounds simple, but it probably isn't.
In short, I need to be able to calculate 3 (6 but the other three are inverted) vectors from any X,Y,Z Euler rotation.
- vector along X axis
- vector along Y axis
- vector along Z axis
The ultimate problem is respecting all 3 axes at once plus the axis order (xzy if I'm right).
This comes very close:
yaw is X, pitch is Z and roll is Y. Z and Y rotation work perfectly, but X is not interpolated correctly. Probably because of the rotation order, but I didn't manage to fix that.
I read the corresponding wikipedia article, but didn't manage to "convert" the given matrix for XZY angles.
Maybe someone has done something similar already, or has an idea how to solve it.
I'm happy about every working solution, but there should be a working way without quaternions and much conversion.
Any help is greatly appreciated!
So, what I want to do sounds simple, but it probably isn't.
In short, I need to be able to calculate 3 (6 but the other three are inverted) vectors from any X,Y,Z Euler rotation.
- vector along X axis
- vector along Y axis
- vector along Z axis
The ultimate problem is respecting all 3 axes at once plus the axis order (xzy if I'm right).
This comes very close:
PHP код:
vx = -cos(yaw)sin(pitch)sin(roll)-sin(yaw)cos(roll)
vy = -sin(yaw)sin(pitch)sin(roll)+cos(yaw)cos(roll)
vz = cos(pitch)sin(roll)
I read the corresponding wikipedia article, but didn't manage to "convert" the given matrix for XZY angles.
Maybe someone has done something similar already, or has an idea how to solve it.
I'm happy about every working solution, but there should be a working way without quaternions and much conversion.
Any help is greatly appreciated!