[BEHAVIOR] Chipmunk Physics

Post your completed addons to share with the community

Post » Sun Nov 01, 2015 11:16 pm

Got a strange issue that I can't figure out. I'm doing a reflected lasers thing which works when the reflectors have circle collision shapes, but not box or segment.

Here's some screencaps to show the problem. First the circle colls which work as expected:
https://dl.dropboxusercontent.com/u/523 ... Colls.webm

Now box colls:
https://dl.dropboxusercontent.com/u/523 ... Colls.webm

This is the event sheet. A pool of laser & hit sprites are created on start, then every tick they're moved offscreen before some recursive raycasting happens:
https://dl.dropboxusercontent.com/u/523 ... roblem.png
B
27
S
12
G
1
Posts: 157
Reputation: 3,359

Post » Mon Nov 02, 2015 4:28 pm

@R0J0hound (& anyone else)
Here's a capx of the problem mentioned above. I can't see why this doesn't work, maybe it's something chipmunk-specific that i'm missing?

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

Post » Mon Nov 02, 2015 5:47 pm

@mattb , The next laser is getting caught on the edge of the square(you can see there are more than one contact object on the edge when no laser reflects)..
here's the fix: Image
B
43
S
19
G
65
Posts: 1,104
Reputation: 37,945

Post » Mon Nov 02, 2015 6:30 pm

Thanks! That does help, which is strange because I also tried excluding the last hit object from the Laser function & that did nothing.

It's still not working fully though. Check this screenshot, there should be 10 segments showing but only 7 are made (this is with hitX/Y moved out 10 pixels):
https://dl.dropboxusercontent.com/u/523 ... erfail.png
B
27
S
12
G
1
Posts: 157
Reputation: 3,359

Post » Mon Nov 02, 2015 6:35 pm

@mattb , increase the raylength. The ray checked its complete length of 1000, and there weren't any collisions so it made no reflections. Use a higher raylength and it'll work.
B
43
S
19
G
65
Posts: 1,104
Reputation: 37,945

Post » Mon Nov 02, 2015 10:15 pm

doh, been having a bad debugging day. thanks :) here's the fixed setup for anyone that's interested: https://dl.dropboxusercontent.com/u/523 ... Fixed.capx
B
27
S
12
G
1
Posts: 157
Reputation: 3,359

Post » Wed Nov 04, 2015 7:21 am

Is anyone else having problems with the built-in save/load system, the physics seem to lag behind a fair bit.
https://www.dropbox.com/s/gsuj4ni4vnjvfj6/chipmunk%20problems.capx?dl=0
Have retro games for sale? Buy & Sell Retro Games UK
B
9
S
2
Posts: 68
Reputation: 768

Post » Wed Nov 04, 2015 6:26 pm

@MiniHulk
That's interesting it pauses for a bit, no idea why it does that. The behavior actually has nothing in place to support save/load currently.
B
92
S
32
G
107
Posts: 5,274
Reputation: 69,959

Post » Fri Nov 13, 2015 7:52 pm

Just wanted to report that the newest beta version of Construct 2 r217 causes 10% increase in CPU usage, not sure why. Box2D seems to be significantly stronger in processing large amounts of collisions. I dont remember this being the case before. But perhaps it was.
B
5
S
1
Posts: 68
Reputation: 515

Post » Mon Nov 16, 2015 3:24 am

@Itenimum1
Nothing's changed with the plugin of even c2's runtime that should effect the performance as far as i know.

One reason why a large amount of collisions would be slower than with the physics behavior is the pre and post collide triggers i imagine.
B
92
S
32
G
107
Posts: 5,274
Reputation: 69,959

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 4 guests