25.10.2011, 23:44
Well the code for getting the matrix can be this:
then using the matrix you're gonna get the vectors:
http://www.facstaff.bucknell.edu/mas...ecMultiply.htm
(or just ******: matrix to vector)
I'm also no expert at quaternions (however I'm looking for a maths teacher who can teach it to me), but I try to help you as hard as I can.
page 7+ from this pdf explain very much:
http://www.euclideanspace.com/maths/...raining001.pdf
pawn Код:
#include <a_samp>
forward Float:QuatTo3x3Matrix(Float:w,Float:x,Float:y,Float:z);
stock Float:QuatTo3x3Matrix(Float:w,Float:x,Float:y,Float:z)
{
new Float:Matrix[3][3];
Matrix[0][0] = 1 - (2*(y*y)) - (2*(z*z)); Matrix[0][1] = (2 * x * y) - (2 * z * w); Matrix[0][2] = (2*x*z)+(2*y*w);
Matrix[1][0] = ( 2*x*y ) + ( 2 * z * w ); Matrix[1][1] = 1 - (2*x*x) - (2* z * z ); Matrix[1][2] = (2*y*z)-(2*x*w);
Matrix[2][0] = ( 2*x*y ) - ( 2 * y * w ); Matrix[2][1] = (2*y* z ) + ( 2 * x * w ); Matrix[2][2] = 1 - (2*(x*x)) - (2*(y*y));
return Matrix;
}
public OnFilterScriptInit()
{
new Float:test[3][3];
test = QuatTo3x3Matrix(0.0,0.0,0.0,0.0);
return 1;
}
//http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToMatrix/index.htm
http://www.facstaff.bucknell.edu/mas...ecMultiply.htm
(or just ******: matrix to vector)
I'm also no expert at quaternions (however I'm looking for a maths teacher who can teach it to me), but I try to help you as hard as I can.
page 7+ from this pdf explain very much:
http://www.euclideanspace.com/maths/...raining001.pdf