www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: tollos on June 13, 2013, 12:53:43 pm

Title: Multiple rotations on different pivots
Post by: tollos on June 13, 2013, 12:53:43 pm
Hello Egon,

Just a little question about multiple rotations with multiple pivots on the same object.

I'm first setting a pivot, do a rotation then I'm changing the pivot and do another rotation but it seems that both rotations uses the last pivot I provided.

Is it intended ? If so, how could I do to resolve this issue ?

Thanks in advance!

Title: Re: Multiple rotations on different pivots
Post by: EgonOlsen on June 13, 2013, 03:49:10 pm
Is it intended ? If so, how could I do to resolve this issue ?
Yes, that's how it is. Rotations are cumulative and happen around the current pivot at render time. If you want multiple pivots, you can try to add some dummy objects that represent these pivots and create parent-/child-relations between those. Be prepared for some serious headache though...dependant rotations can drive you mad. If it's somehow possible to avoid them, then do it.
Title: Re: Multiple rotations on different pivots
Post by: tollos on June 13, 2013, 04:20:53 pm
Arg it's gonna be hard ...
Maybe if you could give me a little advice on how to implements it then, it would be very nice ;-)

In the attached picture you can see what I intend to do

In the first you can see the 2 objects I want to move (A&B) and the pivots I have (1&2).
In the second one, it's what I have now, when I rotate the object A around pivot 1, I also rotate object B around pivot 1 so it's at the correct position.
What I want is the third one, after the first rotation for the position, I want to rotate it back to vertical position around pivot 2.

I think that by moving B to the correct position instead of rotating it should do the trick but no idea how ...  ???

I hope it's clear and that you have an idea how I could implement it.

Thanks in advance !



[attachment deleted by admin]
Title: Re: Multiple rotations on different pivots
Post by: EgonOlsen on June 13, 2013, 05:04:11 pm
Make b a child of a, set b's rotation pivot to 2 and rotate b. That should actually do the trick.
Title: Re: Multiple rotations on different pivots
Post by: tollos on June 13, 2013, 05:06:44 pm
Okay I'll try that, thanks ;-)