I've been trying to rotate a box around a certain point (for the purpose of angular velocity). I Know how to rotate the mesh around a point by changing the origo in mesh space, but the problem is that the i don't know how to rotate the Position variable too. Because if i change the rotation point(and the mesh origor) then the box "jumps" so the new origo in mesh space.
Here's a pic for further explanation:
The Plus is the Box Mesh Origo and the red circle is the Rotation Point.
Thanx in advance
Turn Object around Point
Started by Johannes1991, Oct 26 2011 07:06 AM
1 reply to this topic
Sponsor:
#2 Members - Reputation: 494
Posted 28 October 2011 - 12:50 PM
You have the position and orientation of the object. The position is a translation and the orientation is a rotation. If the object is orbiting a point then you calculate the position with a rotation, but what you get is a translation vector. If you're rotating the object about a point other than it's origin then then you translate that point to the origin, rotate the object, translate it back. Though there's a translation in there it starts and ends at the same place so it's really just a rotation. Generally people use uniform scaling so that's just a scalar. You keep those seperate. So you can have an object rotating as it orbits a point while growing larger and shrinking back with it all being easy to keep track of. You could combine all that into a single matrices, but some of the cells are going to be equations since time is a factor. That would get all nasty and ugly, but simply a vector the position, a matrix for the orientation and a number for the scale keeps things nice and simple.
As your scene gets more complex it helps to break it into a heirarchy. Picture the typical amusement park ride. Oh my God there's stuff going everywhere. These are all orbiting that and the whole group is orbiting this other. If you break it down into a heirachy though each individual piece is simple. That's why you get a standard of view, world and object space. That's generally needed just for a static scene of any reasonable complexity with nothing moving. When things start moving relative to another you start needing to break those object space down into subspaces. You have clown on a golf cart on a cruise ship juggling three balls in the air. If we know where the golf cart is on the cruise ship and where the cruise ship is in the world then we can say where in the world the golf cart is. The position of the golf cart relative to the ship might be somewhat complex relative to the cruise ship, but relative to the world even more so. So you break it down to keep it simple.
As your scene gets more complex it helps to break it into a heirarchy. Picture the typical amusement park ride. Oh my God there's stuff going everywhere. These are all orbiting that and the whole group is orbiting this other. If you break it down into a heirachy though each individual piece is simple. That's why you get a standard of view, world and object space. That's generally needed just for a static scene of any reasonable complexity with nothing moving. When things start moving relative to another you start needing to break those object space down into subspaces. You have clown on a golf cart on a cruise ship juggling three balls in the air. If we know where the golf cart is on the cruise ship and where the cruise ship is in the world then we can say where in the world the golf cart is. The position of the golf cart relative to the ship might be somewhat complex relative to the cruise ship, but relative to the world even more so. So you break it down to keep it simple.
Keys to success: Ability, ambition and opportunity.






