Converting from 3 vector rotation to Quaternion

Well I am using a 3 vector approach for my rotation. up vector, down vector and side vector. Jme is using a single quaternion.



Is there anyway I can convert these 3 vectors to a single Quaternion?

What exactly do you mean by those vectors?



You can do this:



[/code]

Quaternion q = new Quaternion(new float[] { leftRot.x, upRot.y, dirRot.z });

[/code]



Theres also another way to do this (im sure, but i dont know for sure):



Quaternion q = new Quaternion();
q.toRotationalMatrix().fromVectors(left, up, dir);



(Above code is pseudo-code, but similar method names should be there...)

DP

Well its quite simple. Every object has a position and a rotation. The position is in the world. the rotation is relative to the position. The 3 vectors represent a local coord system, x,y,z, just as the single Jme quaternion. I prefeer to use the 3 vector approach because


  1. all my code does


  2. I understand it somewhat… Quaternions are a black hole for me



    I’ll look at the fromvectors method… thanks

DP is on the right track. Basically, those three vectors that define the coordinate system of your object correspond to a rotation matrix. Quaternions can be created from the rotation matrix.