Hi,
I'm trying to make a top-down pool game. Everything is going great, but my circles never seem to want to rest. Is there an attribute/setting that specifies a minimum speed that objects rest at? Should I just loop through all my objects each tick and rest those that are going slow enough? How do I manually rest a body?
An unrelated question - any brainstorms for the best way to detect if the ball is over the pocket? Put another shape on a different layer and figure out what % of overlap there is?
Thanks!
Patrick
Top-down objects never rest
-
- Posts: 4
- Joined: Fri May 01, 2009 10:00 pm
- Contact:
-
- Posts: 4
- Joined: Fri May 01, 2009 10:00 pm
- Contact:
Re: Top-down objects never rest
I've figured out some of my question - I had used the grabbed example and their damping was in the accelerometer code (which I figured would be called so I left it there). It works much better in the init I set damping to 0.5 and it seems pretty good.
-
- Posts: 157
- Joined: Mon Aug 20, 2007 12:53 pm
- Location: London, UK
- Contact:
Re: Top-down objects never rest
You could make a circle collision shape in the middle of the pocket, but subtract the radius of the ball from the radius of the pocket when setting the radius of the collision shape. That way you'll get a collision when the centre of the ball is over the pocket.allenp wrote:An unrelated question - any brainstorms for the best way to detect if the ball is over the pocket? Put another shape on a different layer and figure out what % of overlap there is?
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: Top-down objects never rest
You could use a collision callback, but I'd probably just iterate the list of balls after every frame and check if they are close to the center of any of the holes. It would end up being like 10 lines of code maybe and slightly simpler than setting up collision callbacks and whatnot.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
-
- Posts: 4
- Joined: Fri May 01, 2009 10:00 pm
- Contact:
Re: Top-down objects never rest
In case anyone was curious - I ended up using a collision callback and checking to see if the center of the pool ball was within the circle of the pocket. If it was I applied a force to the ball towards the center of the pocket, and then if both their centers were within a certain distance, I "sunk" the ball.
Thanks for such an easy to use physics framework! The collisions were really easy once I saw some examples.
Thanks for such an easy to use physics framework! The collisions were really easy once I saw some examples.
-
- Posts: 4
- Joined: Fri May 01, 2009 10:00 pm
- Contact:
Re: Top-down objects never rest
In case anyone was curious - I ended up using a collision callback and checking to see if the center of the pool ball was within the circle of the pocket. If it was I applied a force to the ball towards the center of the pocket, and then if both their centers were within a certain distance, I "sunk" the ball.
Thanks for such an easy to use physics framework! The collisions were really easy once I saw some examples.
Thanks for such an easy to use physics framework! The collisions were really easy once I saw some examples.
Who is online
Users browsing this forum: No registered users and 8 guests