Need Help with quaternions in libogc

Post Reply
psycorpse
Posts: 9
Joined: Sun Sep 13, 2009 6:37 pm
Location: St Louis, MO USA
Contact:

Need Help with quaternions in libogc

Post by psycorpse » Fri Feb 06, 2015 3:13 am

I am trying to use quaternions and they do not appear to be working for me (Its probably me).

Here is some of the code that I am trying and its not giving me the results that I was expecting and I don't really know how to troubleshoot this.

Code: Select all

        guMtxIdentity(q);
	c_guMtxQuat(q, &cubeQuat);

        guVector axis = {0,1,0};
	guMtxRotAxisDeg(QuatMatrix, &axis, rot);
	
	// MtxQuat should take a matrix and turn it into a quat
	c_guMtxQuat(QuatMatrix, &cubeQuat);

        c_guQuatMtx(&cubeQuat, TempQuatMatrix);

	// Multiply the Rotation (QuatMatrix) with the ModelMatrix into TempModelMatrix
	guMtxConcat(TempQuatMatrix, ModelMatrix, TempModelMatrix);

When I do this, the cube that was in my view, is no longer in my view. If I took out the Quat stuff and just left the RotAxisDeg the cube would be spinning in the view.

If someone has an example that I could read and learn from that would be the best option but I will take any advice/knowledge that anyone has.
Currently doing 3ds game programming!
Website: http://www.stlwd.com

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests