Accessing individual vector xyz coordinates
by Zach Broderick · in Technical Issues · 11/22/2007 (9:43 pm) · 2 replies
Ive searched and searched but I can't find anywhere how to access individual vector coordinates.
The vector in question is going to be used for an applyImpulse() function.
I need to make the Z axis 0, and I need to turn the vector 90 degrees counterclockwise on the XY axis.
I'm fairly confident in my ability to do this, if I could just access the individual axises.
I'm assuming its something along the lines of %variableName.setZ(); or %variableName[3] = 0; And I've tried everything I can thing but I cant get it to work out.
The vector in question is going to be used for an applyImpulse() function.
I need to make the Z axis 0, and I need to turn the vector 90 degrees counterclockwise on the XY axis.
I'm fairly confident in my ability to do this, if I could just access the individual axises.
I'm assuming its something along the lines of %variableName.setZ(); or %variableName[3] = 0; And I've tried everything I can thing but I cant get it to work out.
#2
It worked perfectly.
For anyone interested in how I rotated the vector 90 degrees look here.
Incase the link dies...
In a right-handed coordinate system, the rotations are as follows:
90 degrees CW about x-axis: (x, y, z) -> (x, -z, y)
90 degrees CCW about x-axis: (x, y, z) -> (x, z, -y)
90 degrees CW about y-axis: (x, y, z) -> (-z, y, x)
90 degrees CCW about y-axis: (x, y, z) -> (z, y, -x)
90 degrees CW about z-axis: (x, y, z) -> (y, -x, z)
90 degrees CCW about z-axis: (x, y, z) -> (-y, x, z)
If you're using a left-handed coordinate system, simply switch 'CW' with 'CCW' above.
11/23/2007 (12:00 am)
Wow super fast reply, thanks Brian.It worked perfectly.
For anyone interested in how I rotated the vector 90 degrees look here.
Incase the link dies...
In a right-handed coordinate system, the rotations are as follows:
90 degrees CW about x-axis: (x, y, z) -> (x, -z, y)
90 degrees CCW about x-axis: (x, y, z) -> (x, z, -y)
90 degrees CW about y-axis: (x, y, z) -> (-z, y, x)
90 degrees CCW about y-axis: (x, y, z) -> (z, y, -x)
90 degrees CW about z-axis: (x, y, z) -> (y, -x, z)
90 degrees CCW about z-axis: (x, y, z) -> (-y, x, z)
If you're using a left-handed coordinate system, simply switch 'CW' with 'CCW' above.
Torque Owner Michael Bacon
Default Studio Name