Jump to content
  • Advertisement
Sign in to follow this  
Johannes1991

Turn Object around Point

This topic is 2602 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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:
[attachment=5856:Pic.png]
The Plus is the Box Mesh Origo and the red circle is the Rotation Point.

Thanx in advance

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!