[BEHAVIOR] Chipmunk Physics

Post your completed addons to share with the community

Post » Sun Feb 22, 2015 4:36 pm

Roid rage :D 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?
You do not have the required permissions to view the files attached to this post.
B
27
S
12
G
1
Posts: 157
Reputation: 3,359

Post » Mon Feb 23, 2015 1:08 am

@mattb
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))
You do not have the required permissions to view the files attached to this post.
B
94
S
33
G
118
Posts: 5,396
Reputation: 75,853

Post » Mon Feb 23, 2015 11:09 am

@R0J0hound - that works brilliantly, thank you! And I think I get it now too.
@mattb - nice demo I like the grapple mechanic there
B
44
S
13
G
8
Posts: 622
Reputation: 7,417

Post » Mon Feb 23, 2015 1:48 pm

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 ;)

https://dl.dropboxusercontent.com/u/523 ... index.html
B
27
S
12
G
1
Posts: 157
Reputation: 3,359

Post » Mon Feb 23, 2015 3:20 pm

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

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

Image

Image
B
44
S
13
G
8
Posts: 622
Reputation: 7,417

Post » Wed Feb 25, 2015 5:50 pm

Hi,
On my capx, standard phycic behavior seems to be more accurate than chipmunk regarding collisions. What did I do wrong ?

http://canapin.com/construct/tests/physicstiles/

physicstile.png


physicstile.capx
You do not have the required permissions to view the files attached to this post.
B
12
S
7
G
7
Posts: 450
Reputation: 4,276

Post » Wed Feb 25, 2015 6:34 pm

Chipmunks collision response is just spongier than box2d as best I can tell.
B
94
S
33
G
118
Posts: 5,396
Reputation: 75,853

Post » Thu Feb 26, 2015 12:26 pm

Crudemik - great stuff, but you can move development back from unity now we have better physics :)

@R0J0hound does the javascript port of chipmunk have the autogeometry feature?
B
27
S
12
G
1
Posts: 157
Reputation: 3,359

Post » Thu Feb 26, 2015 6:09 pm

@mattb
No it doesn't. It's part of the now free chipmunk2d pro version which isn't really portable like the normal chipmunk2d api.
B
94
S
33
G
118
Posts: 5,396
Reputation: 75,853

Post » Thu Feb 26, 2015 7:23 pm

outside position updating is worst then web.js for collision games (as pool ) nothing much different...
B
78
S
23
G
69
Posts: 1,354
Reputation: 44,027

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 1 guest