I have a very simple scene that contains a cube. I want to be able to drag the cube around with the mouse, in a way that syncs perfectly with the mouse. The mouse cursor should always remain over the object, and visually, the object should move as much as the mouse did.
Here's the code I have now:
This works fine when I put the camera in Orthographic mode. So I'm guesing the problem is the perspective isn't taken into account. I should have my cube move more when it is far, and move less when it is close, so that its always in sync with the mouse, but I don't know how to do it.
asked May 17 '10 at 06:17 PM
the third argument of ScreenToWorldPoint is the distance between camera and the cube. also in last line you can set the
i have a code that i am sure that it works
answered May 17 '10 at 06:28 PM