Some questions to begin with chipmunk

Official forum for the Chipmunk2D Physics Library.
Post Reply
Bieon
Posts: 2
Joined: Thu Jul 07, 2011 7:03 am
Contact:

Some questions to begin with chipmunk

Post by Bieon »

Hey!

I would like to create a game, and I think that I will use chipmunk to manage physics.
So, my first question : is chipmunk adapted for a racing game on computer? (I heard it's rather adapted for iphone games, is it?)

I've already tried some basic simulations, but I'm wondering many things : really, a body A with a higher mass than a body B get a higher velocity, because of damping. With chipmunk, it seems that there isn't this phenomenon, regardless of the damping. Why?

I also noticed that we cannot define an angular damping different from the linear one. How to simulate this?
I added this code :

Code: Select all

cpBodySetAngVel(body2, cpBodyGetAngVel(body2)*0.95);
cpSpaceStep(space, 0.01);
But I guess it's not the best way to do it.

And my last question : I don't understand how to create a static body, the only way I found was to use cpSpaceAddStaticBody, but the doc says it's deprecated. So, what's the good way to create a static body?

I've undoubtedly missed something in the doc, but I'm french and my english is not perfect :s .
I'm french so I guess my english isn't perfect. Sorry for my mistakes.
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Some questions to begin with chipmunk

Post by slembcke »

Chipmunk was written years before the iPhone came out. It's probably better optimized for desktop CPUs because of it.

The damping applied by a space is just simple damping (like velocity *= 0.99). It's not the same as drag, which would be affected by mass and shape. For most games, simple damping looks the same as drag and is much cheaper to compute. If you want to compute more complicated drag forces, or have separate linear/angular damping you'll have to implement that yourself.

Do you mean static shape? Static shapes are just shapes that are connected to static bodies. You don't have to create them as static. Static bodies are created by calling cpBodyNewStatic(). The cpSpaceAddStaticShape() function is deprecated because any shape attached to a static body is now automatically added using cpSpaceAddStaticShape() now.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Bieon
Posts: 2
Joined: Thu Jul 07, 2011 7:03 am
Contact:

Re: Some questions to begin with chipmunk

Post by Bieon »

Ok, so I will use this engine, it seems adapted for my game.

So, thank you for your answers ;) , now I think I've understood how it works.
(I thought damping was the same as drag, and I hadn't seen the function cpBodyNewStatic() )
I'm french so I guess my english isn't perfect. Sorry for my mistakes.
Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests