[BEHAVIOR] Chipmunk Physics

Post your completed addons to share with the community

Post » Wed Oct 21, 2015 8:42 pm

How can I handle collisions between fast moving objects, like the Bullet yes/no in the official physics behavior?
B
15
S
3
G
3
Posts: 93
Reputation: 1,466

Post » Wed Oct 21, 2015 8:46 pm

Giganten wrote:How can I handle collisions between fast moving objects, like the Bullet yes/no in the official physics behavior?

@Giganten Use Chipmunks physics on the bullet object (there's no need for you to use bullet behaviour I think, the chipmunk should suffice).
B
14
S
3
G
1
Posts: 77
Reputation: 1,035

Post » Wed Oct 21, 2015 8:57 pm

@Giganten
The chipmunk physics library doesn't support that. If you want it for something like bullets then ray casting might work for you.
B
92
S
32
G
106
Posts: 5,273
Reputation: 69,457

Post » Wed Oct 21, 2015 9:14 pm

okay, was trying to use it for fast moving balls, like a pinball game.
B
15
S
3
G
3
Posts: 93
Reputation: 1,466

Post » Fri Oct 23, 2015 12:11 pm

How would one go about creating a button/switch tile in chipmunk physics that is pushed down when another physics object is on it and lifts back up after other object is not on it anymore? Do I need to set up some kind of joint for it to bounce back up or what would be the best approach?
B
32
S
9
G
4
Posts: 133
Reputation: 4,350

Post » Fri Oct 23, 2015 2:43 pm

@Giganten
I've found that as long as physics shapes are fired & deflected using forces or impulses the collisions are ok (for realistically high speeds, I haven't tried super fast). It's only when you set velocity manually that things start intersecting a lot, so avoid that if you can.

@Waltuo
This is how I'm doing buttons in a platformer where they're triggered by physics. No chipmunk on the button, just overlap testing:
https://dl.dropboxusercontent.com/u/523 ... events.png
B
27
S
12
G
1
Posts: 157
Reputation: 3,359

Post » Fri Oct 23, 2015 9:42 pm

@R0J0hound
Any idea how to set phase for these gear joints? I've tried signed angle difference & that doesn't work:
https://dl.dropboxusercontent.com/u/523 ... rtest.capx
B
27
S
12
G
1
Posts: 157
Reputation: 3,359

Post » Sat Oct 24, 2015 6:51 pm

@mattb
The way I look at it the angles of the two gears are related like this:
gearB.angle = (gearA.angle-gearA.initialAngle)*ratio + gearB.initialAngle

So when gearA.angle is zero gearB.angle is:
= -gear.InitialAngle*ratio + gearB.initialAngle
Make that negative and we get the phase:
phase = gear.initialAngle*ratio-gearB.initialAngle

Ok, to simplify the angle calculations make sure the angle of every gear is between 0 and 180 degrees. Then using the following makes rotations spot on in your capx:
phase = -gear.Angle+fGear.n/Gear.n*-fgear.Angle
B
92
S
32
G
106
Posts: 5,273
Reputation: 69,457

Post » Sun Oct 25, 2015 1:37 pm

I'd never have got that, thanks :D

Here's the fixed capx in case anyone's interested: https://dl.dropboxusercontent.com/u/523 ... test2.capx
B
27
S
12
G
1
Posts: 157
Reputation: 3,359

Post » Mon Oct 26, 2015 10:25 pm

@mattb thanks for sharing, it's appreciated!
B
32
S
9
G
4
Posts: 133
Reputation: 4,350

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 2 guests