Starting Point

Official forum for the Chipmunk2D Physics Library.
Post Reply
ivico92
Posts: 2
Joined: Mon Apr 19, 2010 3:06 pm
Contact:

Starting Point

Post by ivico92 »

Hi all,
I'm new to Chipmunk and I'm glad to join the forum (I believed I never catch the correct confirmation code when registering ^^).

I did the Alexandre Gomes's tutorial (he did a really clean stuff), but I would like to get deeper now and I can't find anything to learn how to create and use springes, joints etc.

Any link for a good starting point would be welcome ^^

See ya,
Vico
maximile
Posts: 157
Joined: Mon Aug 20, 2007 12:53 pm
Location: London, UK
Contact:

Re: Starting Point

Post by maximile »

I don't know of any specific tutorials, but you can get a long way by looking at the Chipmunk demos that come with the source. That's often enough to get you started, and if you get stuck you can always ask here.
ivico92
Posts: 2
Joined: Mon Apr 19, 2010 3:06 pm
Contact:

Re: Starting Point

Post by ivico92 »

Hi Maximile,
Yes I did, but it seems it uses classes specially made for the demo because when I learnt the "springes.c" code, I saw calls of methods defined in classes that are only in the demo... (so I had try copying these classes in my project but it screw it all ^^)

I can't figure out how to learn, step by step, how to use each object. (An experienced programer probably goes to the classes definitions and find the way, but I'm not this one). Need explanations in English (french would be perfect but I won't push it^^).

you, did you started and find your way just by looking at the sample codes ?


thx,
Vico
User avatar
mallyone
Posts: 9
Joined: Mon Apr 26, 2010 8:31 am
Contact:

Re: Starting Point

Post by mallyone »

ivico92 wrote:Hi Maximile,
Yes I did, but it seems it uses classes specially made for the demo because when I learnt the "springes.c" code, I saw calls of methods defined in classes that are only in the demo... (so I had try copying these classes in my project but it screw it all ^^)

I can't figure out how to learn, step by step, how to use each object. (An experienced programer probably goes to the classes definitions and find the way, but I'm not this one). Need explanations in English (french would be perfect but I won't push it^^).

you, did you started and find your way just by looking at the sample codes ?
I'm fairly new to chipmunk so any other chipmunker please pipe in if I'm incorrect.

Re: classes and objects, chipmunk is straight c, but does have bindings to other languages. I'm pretty sure what your looking at as classes/objects are actually structures (or structs).

As for creating a joints, it can be a one liner:

Code: Select all

cpSpaceAddConstraint(space, cpDampedSpringNew(staticBody, player1, cpv(100.0f, 100.0f), cpvzero, 100.0f, 30.0f, 0.9f));
This creates a spring joint attached to the player1 body and pinned to cpvzero on staticBody. See http://code.google.com/p/chipmunk-physi ... ped_Spring: for the damped spring function.
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Starting Point

Post by slembcke »

Hrm. Seems like I missed this thread.

Each of the demos is straight C with no classes and is self contained in it's own file (beyond the usual Chipmunk files and a few variables for grabbing the state of the mouse and arrow keys). If you were seeing classes being used, were you looking at the Objective-Chipmunk iPhone demos?
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: Bing [Bot] and 12 guests