Buncha Questions

Official forum for the Chipmunk2D Physics Library.
Post Reply
tiglionabbit
Posts: 2
Joined: Sun Oct 26, 2008 2:53 am
Contact:

Buncha Questions

Post by tiglionabbit »

I've heard it's recommended to use surface velocity to move your player. However, mine keeps falling on his back. How do you handle this?

Also, if surface velocity affects all sides of the object in the same direction, you wouldn't be able to balance something on your head without attaching another shape, would you? This feature seems a little odd to me -- I'd think you'd just give it one dimension of velocity that acts clockwise or counter-clockwise depending on its sign.

Can I add a collision pair function for things of collision type 1 with all other things regardless of type? For example, to allow a player to jump off of any object, one must know if the player is standing on an object.

Do you know of a good algorithm for breaking down a concave shape into the smallest amount of convex shapes that would fill the same space?

(and now for the zany stuff)

Can you think of a way to model aerodynamics in chipmunk? For example, a dart tending to line up with the direction of its velocity, a dolphin beginning a turn by bending its body, a skydiver falling faster when his limbs are together.

What about top-down wheel-tracking for a car -- that is, how a car rarely drifts sideways unless it has a lot of momentum.

Or a character sliding down walls like megaman
ker
Posts: 56
Joined: Tue Jul 15, 2008 4:13 am
Contact:

Re: Buncha Questions

Post by ker »

If you'd read the other posts to the end you'd find several of your questions already answered ;)

Falling Over Issue: Set the Inertia of your body to INFINITY
All Sides issue: Yea you need a second shape that stops anything from getting to the inner shape except at the bottom.
Convexizer-Algorithm: sorry, no idea here :) Try some math sites and college faculty sites, they tend to have a lot information on algorithms.
Aerodynamics would have to be programmed manually, a billion particles probably aren't what you asked for ;)
Top Down Friction is not (yet?) implemented in chipmunk, there are 2 or 3 threads talking about that.
Character sliding down walls: chipmunk has friction! That should do (or I misunderstood your question)
debug
Posts: 19
Joined: Sun Nov 23, 2008 4:42 pm
Contact:

Re: Buncha Questions

Post by debug »

"Convexiser"

you are after something called an ear clipping algorithm
there are several steps involved outlined below in simplified form

1) convert your concave polygon into triangles
2) starting with the first triangle start adding triangles to it building up a polygon
3) for each triangle added test if you are still convex
4) if you are no longer convex discard the triangle and try adding the next one
5) when you run out of triangles start over with the remaining unassigned triangles
6) when you run out of unassigned triangles you now should have N convex polygons

some considerations

this will probably fail if the polygon self intersects so you would need to rationalize the shape first using outside edge detection for the outside of the polygon
maybe you should check the winding of the polygon and rewind it to CCW before triangulation
maybe you should check the winding of each triangle and rewind it to CCW before polygonization
maybe you should check the resulting polygons and rewind those to CCW after polygonization
probably a good idea if you are using large point sets to use a ramer or dougles-peuker line approximation algorithm on the point set first
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 29 guests