Jump to content
  • Advertisement
Sign in to follow this  
sefiroths

OpenGL movement of node like 3d studio

This topic is 4020 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, i'd like to move a node like 3d studio. i use opengl. i have completed some steps: 1) i created 3 axis and 2) i can select the direction and drag and drop the arrow 3) in the video below i show what i obtain, i resolved the problem that the direction didn't match sometimes (the video is a bit old) http://sephiroth.web-gratis.net/problemamaniglie.htm the problem is that: 1) the mouse can move everywhere in the screen but the arrow only in one direction 2) the traslation of the mouse and of the arrow aren't the same how can i vincolate the mouse to be over the arrow all the time, or the arrow over the mouse...? thanks

Share this post


Link to post
Share on other sites
Advertisement
Do you mean that by clicking on an axis - let's say the x-axis - the object should only be allowed to move on that axis if the mouse is moved?

Try this:

1. Project the mouse coordinates of the start (S) and end (E) points onto the plane described by the selected axis and your camera's up vector (e.g. by shooting two rays in the scene and intersecting them with the plane). You get S' and E'

2. Project both points on the plane onto the axis. You get S'' and E''.

3. Move the object by E'' - S''.

With this you should be able to move the object along a world axis without dependencies on the camera orientation.

Allowing movement on 2 axes would just require you to replace the camera.up vector with the second axis in step 1.

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!