Translation Gizmo
#1 Members - Reputation: 589
Posted 25 September 2012 - 01:07 AM
Thanks
#2 Crossbones+ - Reputation: 1524
Posted 25 September 2012 - 05:31 AM
In my 3D editor i have an Translation gizmo that display the direction which an object is facing. If you select the x axis for example and moved the mouse in the direction of the gizmo it follows that direction. Now the problem that i am having is that if i perform an yaw of 180 degress and the x axis ends up facing the left direction. When i select it and moved the mouse left it end up mirroring instead of moving to the left. I have found that out that my mouse coordinate which i am using as a scale factor to determines whether i moved left or right never changed. So when the x axis values end up been (-1,0,0) for example and when i move my mouse left. it takes the new mouse position and subtract from the old one, i end up with -1 for the mouse as well so when i multiply the mouse delta by the left axis it ends up flipping the axis back to positive. So what i am looking for is a way i can convert my mouse to be in the same space as my camera/object. So to sum it up, i am looking for a way for my gizmos to translate in teh direction that the arrow is pointing too no matter what the orientation of the object or the camera. If anyone can help, i would greatly appreciate it.
Thanks
not certain if i understand you correctly, so i might be way off, but:
if the objects exist on a flat plane, then you could use glUnProject to map your mouse screen coordinates into object space(i'd probably shoot a ray from the front->back of the depth buffer, and get the point on the flat plane that the ray intersects with.) from this, you can simply point the object at the mouse using basic triginometry.
of course this is assuming that the object's rotation is working in 2D(even if it's a 3D application), if you can rotate by all axis's, then i'd probably map the mouse to whichever major axis you are attempting to rotate by.
hope this helps=-)
#3 Members - Reputation: 589
Posted 25 September 2012 - 10:01 AM
#4 Members - Reputation: 589
Posted 25 September 2012 - 05:57 PM






