I'm making a small 3D scene editor (that only allow to modify objects positions).
Each object is draw with a 3d X/Y/Z axis :
How it works : user choose an axis (X, Y or Z) by left clicking on it, then, while holding left click, he move the mouse (to move object in the axis direction)
.
picking is already ok, but i'd like to know how much
the object should be translated for the selected axis, depending 2D mouse movement.
For the example, on this picture, selecting X axis and moving mouse left-right should give a bigger displacement than moving it up-down (almost zero for this one)
It must be really simple but i cannot figure it out.
Input should be : mouse displacement since first left click(2D vector), selected axis vector (3d vector), modelview / projection matrix.
Output : amount (float or double)