Rotate Around Axis..

Started by cyberkilla, February 12, 2007, 05:01:01 PM

Previous topic - Next topic

EgonOlsen

Quote from: "cyberkilla"
Is there a way to split an axis+angle into a vector of x,y,z, where each stores the rotational movement along each axis?
Yes, i think you can derive the angles from a matrix (i've posted some code for this in the past somewhere)...but that would mean that you've to create the matrix first. And if you already have it, why not use it? Just don't use the angle but -angle and you should be fine.

cyberkilla

Excellent:) Thanks :)

EDIT:
Found this...


public SimpleVector deriveAngles(Matrix mat) {
   SimpleVector s=new SimpleVector();
   float[] m=mat.getDump();
   s.x=(float) Math.atan(m[9]/m[10]);
   s.y=(float) Math.asin(-m[2]);
   s.z=(float) Math.atan(m[4]/m[0]);
   return s;
}
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

cyberkilla

I dont believe it!!!! It works!!!!!!!!!!!!!!

Sorry about that:) I still dont believe it:) Im sure Ill discover a better way of doing this, but it looks great for now! Ill screenshot it now.

Ill also document the source code, change it to your xml parser ,and release the code!!!!

Oh, wow!:) You know, there is a lot to be said for trying to do something yourself.
Now we have an essentially working skeletal api:)

Im sure youll be able to go through it, and correct obvious mistakes, or rather, make things more efficient.
The excitement is quite immense. Well worth working until 2:42am for:)
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG