This project has moved. For the latest updates, please go here.

Dragging object with your mouse

Apr 13, 2008 at 8:01 AM
Hello, can i drag the object (both body and the geom) around with mouse?

The thing is, if i use the FixedLinearSpring, the object would not stop when the mouse is stopping (still bouncing around the mouse pointer).

My another attemp is to force the Vector2 position of the mouse to be applied directly to the body's position. Yes the object is now following the mouse precisely. But when used on your demo-4 (pyramid) the box is not collided correctly. Each box could be inside of other box (object inside other object) if i drag it too quickly with my mouse. Maybe because the engine did not have the time to check the collition when i change a body's position? Or because there is no geom point inside of that white boxes (just on the surface of the box)?

Is there any way aroud to drag an object with mouse (fast drag), but still have a correct collition?

Thanks for the reply.
sorry for the bad english, i hope you catch my question...
Apr 14, 2008 at 8:37 PM
You could try using a joint instead of the spring, but you will always have to worry about fast moving objects. The only thing you can to about fast moving objects is reduce the size of your step size.