### Author Topic: Rotate Around Axis..  (Read 7031 times)

#### EgonOlsen

• Posts: 11745
##### Rotate Around Axis..
« Reply #15 on: February 15, 2007, 12:03:47 am »
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

• float
• Posts: 413
##### Rotate Around Axis..
« Reply #16 on: February 15, 2007, 12:07:56 am »
Excellent:) Thanks

EDIT:
Found this...

Code: [Select]
`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

• float
• Posts: 413
##### Rotate Around Axis..
« Reply #17 on: February 15, 2007, 03:52:46 am »
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