Author Topic: Changing rotation pivot at run-time  (Read 816 times)

Offline Irony

  • long
  • ***
  • Posts: 151
    • View Profile
Changing rotation pivot at run-time
« on: April 06, 2013, 03:24:19 pm »
There is a cylinder C with two dummy child objects at the top (T) and bottom(B).
I set C's rotation pivot to B, and do some rotations which work as expected.

When I switch the rotation pivot to T, C suddenly switches its orientation.
I suppose this happens because the new pivot point gets "melted" with the existing rotation matrix.

Is there a way that I can keep the orientation of C as it is, while still having a new pivot point for future rotations?


edit: I had a stupid error in my code that caused the orientation change. The problem now is that the object makes a "jump" when I change the pivot. Probably still an issue with my code though.
« Last Edit: April 06, 2013, 04:05:46 pm by Irony »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: Changing rotation pivot at run-time
« Reply #1 on: April 06, 2013, 06:10:03 pm »
Rotations are cumulative and will be applied around the current rotation pivot. If you change the pivot at runtime, all former rotations will be applied using the new pivot. That will cause the jump effect that you experience.

Offline Irony

  • long
  • ***
  • Posts: 151
    • View Profile
Re: Changing rotation pivot at run-time
« Reply #2 on: April 06, 2013, 09:20:20 pm »
Can I do something about it?