[BEHAVIOR] Chipmunk Physics

Post your completed addons to share with the community

Post » Tue Dec 23, 2014 8:28 pm

update #5
* added preStep trigger. With it you can effectively stop any acceleration due to gravity by applying a force in the opposite direction.
* added "on Post collide" trigger. With it you can get extra info about a physics collision such as:
- contact points, normal, depth, impact, total energy and uid of other object.

@tumira
Ah cool, that's the same bug that SgtConti was getting and I can reproduce it with NodeWebkit. I'll try to debug it tomorrow. Firefox and chrome are working fine though.
B
92
S
32
G
106
Posts: 5,273
Reputation: 69,457

Post » Wed Dec 24, 2014 10:46 am

This is an amazing bit of work. Seems to run smoother than box2D! :o
Don't lose your work. Backup your game with Dropbox.
B
44
S
10
G
10
Posts: 1,106
Reputation: 9,202

Post » Wed Dec 24, 2014 9:42 pm

Update #6
* Fixed the crash on nodeWebkit @tumira @SgtConti
* Reworked it so changing the size/animation will change to collision shape automatically. As a result I removed the "Update collision shape" action which is no longer needed.
* Fixed "pick nearest segment query"/"pick nearest point query" so it would work right when multiple object types are used.

-Merry Christmas
B
92
S
32
G
106
Posts: 5,273
Reputation: 69,457

Post » Wed Dec 24, 2014 9:46 pm

Thanks, R0j0 and Merry Christmas to you.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
134
S
30
G
84
Posts: 5,379
Reputation: 58,440

Post » Thu Dec 25, 2014 7:05 pm

I will definitely try this out next time I require physics in a project. I remember using chipmunk in the past, and it was really great, so I'm excited to see this for construct 2!
B
43
S
19
G
65
Posts: 1,104
Reputation: 37,945

Post » Thu Dec 25, 2014 8:00 pm

@R0J0hound , it doesn't work with tilemaps. I just tested it using a tilemap, and it seems to be using the bounding box of the whole tilemap instead of the polygon that the tiles construct. Even if I switch the option to polygon, it still doesn't collide correctly.
Box2d works correctly with tilemaps, so it would be best if chipmunk also worked with tilemaps. Any plans on implementing this?


edit: also wondering if you'll be adding support for lines.

edit2: been trying to use it, but adding forces to objects seems to mess things up. their points seem to become displaced and move all over inaccurate from the object.. weird... :\
B
43
S
19
G
65
Posts: 1,104
Reputation: 37,945

Post » Fri Dec 26, 2014 4:27 am

@Prominent
Tilemaps aren't properly supported yet. There is some special handling for tilemaps in the built in physics behavior, but there's a few other internal things I want to tweak before implementing it. As of right now it should work with at least sprites and tiledbg.

I'd like to add lines but I need to think of an intuitive way to do it. I'm leaning toward just another collision shape type, along with a radius (which can also be applied to polygon and box btw). If you mean something else or have any ideas of using lines that wouldn't be handled by my idea, let me know.

Thanks for the report on using forces, it was working but I may have broken something with an update. I'll be sure to take a look after the holidays.
B
92
S
32
G
106
Posts: 5,273
Reputation: 69,457

Post » Fri Dec 26, 2014 5:17 am

Okay, cool.
As for lines. I remember using them mainly for constructing a level(tracing around tiles in a tile map procedurally, combining lines that extend from each other so that there aren't unnecessary lines. I forget if I also put them into cells/groups to lower the amount of collision checks, I forget if chipmunk does that sort of thing).. There's probably a lot of uses for them besides that though. I think being able to position the ends of the lines accurately is important. I'm not sure how that would be done if it's just another collisions shape type for an object- unless you put some visual way of showing the line in the editor, and options to edit it? I imagine most people would want to specific where a line starts and ends.
B
43
S
19
G
65
Posts: 1,104
Reputation: 37,945

Post » Fri Dec 26, 2014 10:24 pm

The problem is an interface in the editor to define lines with a start and end point isn't really possible in c2's editor. We're limited to how sprites and other objects can be placed and manipulated. Another issue is behaviors can't draw anything in the editor as I recall. A way to do it from events could be done but it's not quite as user friendly.
B
92
S
32
G
106
Posts: 5,273
Reputation: 69,457

Post » Fri Dec 26, 2014 10:48 pm

@R0j0hound ,
maybe use instance.SetHotspot(p)
for the start point, and a couple variables for the end point(or maybe use an imagepoint for the end point?).
renderer.Line(a, b, color) for drawing the line in the editor.

seems like a way, unless I don't understand what those are for. You probably know better than me.
B
43
S
19
G
65
Posts: 1,104
Reputation: 37,945

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 2 guests