Dragging a circle with a mouse...

Official forum for the Chipmunk2D Physics Library.
Post Reply
raden_muaz
Posts: 9
Joined: Sat Nov 01, 2008 9:52 am
Contact:

Dragging a circle with a mouse...

Post by raden_muaz »

How do I drag a circle or any other shape with a mouse?
Bauerpauer
Posts: 1
Joined: Fri Apr 17, 2009 11:12 am
Contact:

Re: Dragging a circle with a mouse...

Post by Bauerpauer »

I accomplished this by adding active shapes to a body that is NOT added to the space, then directly setting body->p based on the mouse (or in my case, finger) position. The shapes are added to the space, not the body. I'm pretty sure this isn't the recommended way to do this, so I'm curious what others have done to get this working.
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Dragging a circle with a mouse...

Post by slembcke »

There is this code by supertommy that works with Chipmunk 4.1.0 for doing mouse control:
http://www.slembcke.net/forums/viewtopic.php?f=6&t=196

The code in trunk also adds a bunch of new controls for joints that can help make mouse control smoother and more stable. All of the default demos in truck allow you to grab shapes with the mouse.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Post Reply

Who is online

Users browsing this forum: No registered users and 28 guests