[BEHAVIOR] Chipmunk Physics

Post your completed addons to share with the community

Post » Wed Jun 29, 2016 7:54 am

Newer versions of the chipmunk library can have segments collide with segments, but it wasn't ported to JavaScript when I made the plugin.

I'm guessing you got that error because the inertia was set to zero. Maybe because of zero area. Just make it a hair thicker.
B
94
S
33
G
114
Posts: 5,360
Reputation: 73,781

Post » Wed Jun 29, 2016 9:08 am

R0J0's been quite lately because being hound he was looking for me Lord Shiva
B
256
S
39
G
15
Posts: 1,984
Reputation: 41,038

Post » Fri Jul 08, 2016 4:39 am

@R0J0hound , I found a bug that causes the game to freeze :(
capx: https://1drv.ms/u/s!AhHSZHEulqh_gWHiXC4TP0AV8S7_
Seems to happen when you use a 'on pre collide' for an object, and set its velocity at the moment when a group of object collide at the same time.
If you run the capx, it will freeze after a moment when a few boxes collide at exact same time, I think.
B
47
S
22
G
65
Posts: 1,129
Reputation: 38,399

Post » Fri Jul 08, 2016 4:54 am

@R0J0hound , actually.. it appears it happens when an object is asleep. I positioned one to sit above the tilemap and forced it to sleep state on start of layout, and then on pre collide it immediate freezes when velocity is set.

edit: I'm guessing the pre collide isn't meant for applying velocity/etc.
B
47
S
22
G
65
Posts: 1,129
Reputation: 38,399

Post » Fri Jul 08, 2016 5:39 pm

@Prominent
That's odd, but I don't think i'll be able to fix it. It appears to be a bug with the library itself.
When those triggers are called the simulation is in a locked state where only certain things are allowed to happen. To make it work the library delays certain things from being done until the simulation is no longer in a locked state. Also on top of that i've added stuff on top of that. The result is too many cases where things can fail.

The bug here is with waking up sleeping objects when the library is in a locked state.
I guess the workaround for this particular case is to either disable sleeping, or keep those objects awake with a "every tick: wake sprite" event.
B
94
S
33
G
114
Posts: 5,360
Reputation: 73,781

Post » Fri Jul 08, 2016 6:02 pm

@R0J0hound , thanks for the info. Are there any cases that you know of besides 'on pre collide' where this may happen? I just experienced the freeze without any 'on pre collide' actions. Maybe it tried waking up in the 'on pre collide' even though no actions were ran inside the event?
I'm going to disable sleeping for now- I don't plan on having too many objects at a single time.
B
47
S
22
G
65
Posts: 1,129
Reputation: 38,399

Post » Fri Jul 08, 2016 6:15 pm

I'm not aware of any others besides the collision pairs loop i think.
B
94
S
33
G
114
Posts: 5,360
Reputation: 73,781

Post » Sun Jul 10, 2016 4:22 pm

Wow the work put into this, stunning! Thanks for all your hard work!
B
5
S
2
Posts: 18
Reputation: 511

Post » Tue Jul 12, 2016 10:17 pm

Whats a good way to handle a simple knockback... e.g. object 1 hits object 2, knockback object 2 at the angle it was hit.

I've been testing a few things with the various chipmunk actions and nothing seems to work
B
84
S
27
G
9
Posts: 89
Reputation: 9,613

Post » Tue Jul 12, 2016 10:50 pm

@badmiracle
Usually if both objects have the behavior, the knock back is automatic. Or if you want it to be more severe you could apply an impulse on post collide. If one object doesn't have the behavior you can still apply an impulse.
B
94
S
33
G
114
Posts: 5,360
Reputation: 73,781

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 2 guests