Object picking & dragging

Official forum for the Chipmunk2D Physics Library.
Post Reply
henux
Posts: 1
Joined: Mon Jul 20, 2009 11:43 am
Contact:

Object picking & dragging

Post by henux »

Hello.

I am building a game prototype where the player can stack objects on top of each other by picking things up and dragging them around. I would like the object to be frozen to the mouse pointer (positionally and also rotationally) once picked up. The player can then rotate the chosen object by pressing keys like A and S to align it to the desired orientation.

I have tried several implementations on how to do this. The constraints approach used in the Chipmunk demos are not good since the object rotates uncontrollably and bounces around. Changing the velocity for the object based on delta mouse movements isn't so good either as the collision system becomes unstable when colliding with other objects (they tend to overlap). I have also tried to replace the dynamic picked up object with a static one while dragging but this doesn't seem to work either. Any other ideas?

Thanks.
maximile
Posts: 157
Joined: Mon Aug 20, 2007 12:53 pm
Location: London, UK
Contact:

Re: Object picking & dragging

Post by maximile »

I guess set the moment of inertia to infinity (or just a high number) when it's picked up. It's often helpful to reduce the mass and friction as well (only of the object being dragged).
Post Reply

Who is online

Users browsing this forum: No registered users and 23 guests