Jump to content
  • Advertisement
Sign in to follow this  
EvilWeebl

[XNA] rotate object 3ds max style for editor

This topic is 2621 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

Hi all, I'm creating a level editor and am currently working on the gizmo that translates, rotates and scales the objects. Everything is working all right so far but I'd like to implement the rotating like in 3ds max where there is a circle drawn around the object and you highlight it and move the mouse to rotate. At first thought it seems simple but I'm not sure how to do the math for it.

Say if I was looking at an object straight on I would see the entire circle to rotate on the Z axis. If I grabbed the circle representing the Z rotation above the object and moved the mouse right id expect it to turn clockwise, but if I grabbed it below the object I'd expect it to turn anti-clockwise. A lot of it seems to be camera position and mouse movement dependant but I've no idea where to start.

Any help would be much appreciated.

Share this post


Link to post
Share on other sites
Advertisement
Ok so its just occurred to me that all I really need to do is work out the angle between two direction vectors, the direction from the object to where my mouse was and the direction from the object to where my mouse is now. I can even do this by using a 2d plane and vector2's as I'm only working on one axis of rotation at a time.

The question now is how do I get the angle between two vectors? My math isn't what it should be.

Apologies if this topic should have been started in the math section.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!