Object picking & dragging
Posted: Mon Jul 20, 2009 11:53 am
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.
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.