Serching Vectors from Vehicle Quats
#4

Well the code for getting the matrix can be this:
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
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
Reply


Messages In This Thread
Serching Vectors from Vehicle Quats - by Falco-Ger - 25.10.2011, 10:26
Re: Serching Vectors from Vehicle Quats - by Gamer_Z - 25.10.2011, 15:29
Re: Serching Vectors from Vehicle Quats - by Falco-Ger - 25.10.2011, 17:06
Re: Serching Vectors from Vehicle Quats - by Gamer_Z - 25.10.2011, 23:44
Re: Serching Vectors from Vehicle Quats - by Kar - 25.10.2011, 23:55
Re: Serching Vectors from Vehicle Quats - by Falco-Ger - 26.10.2011, 09:38
Re: Serching Vectors from Vehicle Quats - by Gamer_Z - 26.10.2011, 10:06
Re: Serching Vectors from Vehicle Quats - by Falco-Ger - 26.10.2011, 13:39
Re: Serching Vectors from Vehicle Quats - by Gamer_Z - 26.10.2011, 22:32
Re: Serching Vectors from Vehicle Quats - by Falco-Ger - 27.10.2011, 10:36

Forum Jump:


Users browsing this thread: 1 Guest(s)