Page 2 of 2

Re: Matrix Rotation Around Local Axes

Posted: Sun May 02, 2021 1:15 pm
by CuteAlien
I can't remember right now what I needed the quaternion one for. Maybe was just a stupid solution (I also struggled with this ... back then even more). getRelativeRotation with setting old rotation to 0,0,0 and then using result in applyRelativeRotation might kinda work for what you need, not sure.

Matrix order is very important, you have to get that one right. As it means "apply this operation after the previous one". And as you noticed already order of rotations matters.

edit: Maybe you can simplify it for your case by kicking out the scale parts (if you know they are 1,1,1).

Re: Matrix Rotation Around Local Axes

Posted: Tue May 04, 2021 9:26 am
by Acki
I can't get it to work... :cry:

I tried each possible multiplication order (TXYZ, TZYX, XYZT, ZYXT)...
I also tried with/without scale...
I ported all needed functions from the Irrlicht matrix to Java...
no success !!! :(

I have no clue what's wrong...

Re: Matrix Rotation Around Local Axes

Posted: Tue May 04, 2021 10:41 am
by CuteAlien
Put a few test-cases around each function and check if you really get same results.

Re: Matrix Rotation Around Local Axes

Posted: Tue May 04, 2021 4:57 pm
by Acki
what test cases?

I don't get the same results when I change the order...
but it's always wrong...

Re: Matrix Rotation Around Local Axes

Posted: Tue May 04, 2021 6:36 pm
by CuteAlien
Well - you ported the functions to Java. Just call them with a bunch of random parameter to see if you really get same results.

Re: Matrix Rotation Around Local Axes

Posted: Wed May 05, 2021 5:21 pm
by Acki
ok, I made some test cases on Irrlicht, and then the same with my Java code...
and it turned out, the calculations were correct (same results)... :shock:

and now I get THIS:
https://www.youtube.com/watch?v=VrErHDAswP0

I hope you don't mind having one last look at this video...
I won't bother you with this anymore, promised !!! ;)

thanks for the help !!!

Re: Matrix Rotation Around Local Axes

Posted: Wed May 05, 2021 10:50 pm
by CuteAlien
haha - thanks, nice to see :-)

Re: Matrix Rotation Around Local Axes

Posted: Thu May 06, 2021 3:02 pm
by Acki
I had to reverse my rotation order in the render loop from ZYX to XYZ...
but when I change the order in the matrix instead the calculation gives wrong values...

no big deal I can live with the render order XYZ...
but I have to change a few other things also now...

for example...
now I get wrong results calculating the absolute transformation of a scene node... :roll:
but I think I should get this to work...
or it may be another topic to bother you with... :P

bye!

Re: Matrix Rotation Around Local Axes

Posted: Fri May 07, 2021 9:28 am
by smso
I wrote something similar long time ago, these may be of some help:

To rotate / revolve node in world space & in local space:
http://irrlicht.sourceforge.net/forum/v ... =9&t=47924
Look at rotateNodeInLocalSpace() or revolveNodeInLocalSpace()

Regards,
smso