# [BEHAVIOR] Chipmunk Physics

3 favourites
• 703 posts
From the Asset Store
Simple yet very life-like rag doll made with Physics!
• ## Try Construct 3

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• One way to do the front shock is with a groove joint and a spring.

• Thank you both. This will be a good start. I'll let you know if I need any more help.

• hey, I'm trying to work out how to apply force to a position in Chipmunk, any ideas?

Thanks.

• When setting the force use polar instead of rect and use the angle() expression to get the angle.

• Thanks, sorry I'm being a right idiot today, where do I input the angle expression? I'm having trouble working out how to use stuff like in box2D where I'd say apply force +5 at self.angle +90 for example

• here you go:

EDIT - don't use dt

[attachment=0:yk7uh39h][/attachment:yk7uh39h]

• oh great thanks mattb & R0J0hound

• am having trouble trying to re-create a joint from box2D (also I'm stupid). But before I would use "create limited revolute joint" with lower and upper angles of 0 - and that would create a firm, non-flexing or rotating joint between two moving objects at any connecting angle.

box2D

my failure at understanding chipmunk lol

Here's what I'm trying to do:

• Actually I think I might have sussed it out.

haha

• Roid rage I had a go at making something like this & also had trouble with joints. I think I found a bug too, so...

R0J0hound check out the capx below (sorry for not simplifying it). If you enable event 3 then the ContactPointX/Y expressions in event 21 don't seem to work (the hull_damage sprite gets spawned off screen somewhere).

Strangely this happens if you put any actions in the foreach asteroid event.

Also the pin joint doesn't work as expected. Instead you get a freely rotating pivot. Maybe this is how chipmunk works & you need 2 pins to lock a pair of objects together?

• In event 21 you use the loopindex expression and the "for each collision pair" doesn't set it to anything, so the contactpointX() expessions will always return 0, since loopindex defaults to -1 when not in a repeat, for, or "for each sprite" loop. Each collision pair can have more than 1 contact point so adding a repeat Player.Chipmunk.ContactCount times condition to event 21 will help.

Pin joints aren't like the pin behavior. They are a rod connecting two objects. So when you add the joint the distance between the anchor points are kept. See the js demo of it here:

https://dl.dropboxusercontent.com/u/249 ... oints.html

According to the chipmunk forums the way to join two objects together is with two joints. A pivot and a gear joint. I apologize fo the seeminly complicated formula used for the phase of the gear joint. It's the signed angle difference between the two object angles. angle(0,0,cos(a-b),sin(a-b))

• R0J0hound - that works brilliantly, thank you! And I think I get it now too.

mattb - nice demo I like the grapple mechanic there

• Got it Rojo, that makes sense & it works now. I think Chipmunk could do with a new 'bond' or 'superglue' joint which uses the pivot/gear combo.

CrudeMik - that's not grappling. THIS is grappling <img src="{SMILIES_PATH}/icon_e_wink.gif" alt=";)" title="Wink">

https://dl.dropboxusercontent.com/u/523 ... index.html

• mattb - hah that's good! Especially like the boxes.

I've got similar ropes in the unity version of Orbit