I want to drag the objects in 3D consistently based on the current camera position. Currently if i setup a constant amount like this
valX = (x - oldX)/300;
valY = (oldY - y)/300;
This works and the object follows the cursor fine. If i move the camera, the drag amount is slow/fast depnding on if I zoom in/out? Any ideas on how to make it generalized for any zoom value?
Hi Zbuffer,
Thanks for ur reply. Well i have the point already calculated now i need to contol the drag amount such that on zooming in/out the drag amount stays the same.
If you did what I tried to explain, you would not need adjusting at all
Do you need that to work in a generic perspective view, or only 2D views (simpler) ?
Once i have the object space xyz i loop through all my objects and return the first object intersected with this object space xyz (simple aabb test). Are u suggesting that I cast a ray back frm the camera? But I dont understand how this will help me in obtaining the drag amount?
The ray is only needed if you don’t have the winz value.
Form mouse positions A and B you want the world positions A’ and B’ right ? So UnProject both and A and B, then compute the A’B’ distance for world space ‘drag amount’.
Both A and B can have the same winz for a 2D move parallel to the current window.