Reputation: 2128
I want to simulate like a chest opening which is made up of 2 main parts, the lid and the base.
In order to rotate on the x axis, do I need to move the lid to the origin so that: a) any corner of the lid is at (0, 0, 0) or; b) the centre of the lid must be on the origin?
so my code looks like this:
- draw the chest base
- translate to origin
- rotate
- translate to original position
- draw the lid
Upvotes: 1
Views: 700
Reputation: 5409
You should position the lid so that it's pivot point is on the origin. The pivot point is the point on which it rotates, in this case it would be the hinge of your lid.
As for the order of your code:
- draw the chest base
- translate so pivot point of lid is on origin
- rotate
- draw the lid
- translate and rotate to original position
Upvotes: 4