[BEHAVIOR] Chipmunk Physics

Post your completed addons to share with the community

Post » Wed Jan 14, 2015 6:38 pm

Great stuff Rojo, the prevent rotation is appreciated.

I've been trying out constraints today & something that might make the menu more user friendly would be the ability to choose an imagepoint in addition to the rect/polar offset options. Also a pick object menu would be handy.

ps. me & Prominent will buy you some dog biscuits in return for tilemap support :)
B
27
S
12
G
1
Posts: 157
Reputation: 3,359

Post » Thu Jan 15, 2015 1:26 pm

Thank you for your hard work @R0J0hound ! I went ahead and made a little icon to go with the behavior. You can tell right away that it's an icon for a physics behavior right? :) Anyway, anyone is free to use it if they like it, download link is below.

https://dl.dropboxusercontent.com/u/7421687/PluginIcon.ico

Here's how it looks in Construct:
You do not have the required permissions to view the files attached to this post.
B
11
S
2
Posts: 10
Reputation: 618

Post » Thu Jan 15, 2015 2:47 pm

@R0J0hound

A simple manual would be great. I really thought common sense would kick in once i started using some of the features. However this has just pointed out i dont have any :(

Another thing while i am here. I have noticed that applying Keyboard UP or Keyboard Left returns NaN for the speed.
You do not have the required permissions to view the files attached to this post.
Last edited by spongehammer on Fri Jan 16, 2015 8:43 am, edited 1 time in total.
B
47
S
16
G
9
Posts: 1,097
Reputation: 11,180

Post » Thu Jan 15, 2015 10:55 pm

Has anyone done some benchmarks for this? How does it compare to box2d web and ams.js?
Image
B
33
S
11
G
2
Posts: 563
Reputation: 5,141

Post » Fri Jan 16, 2015 2:43 am

Can't be any more help, other than to say this plugin has a pretty big performance leak. All I did was left the demo you have running for a couple hours, came back, and it was running at 10fps from 60fps.... turned it off, then back on again, and it was fine. Perhaps it was a fluke? I'll do it again tonight before I go to bed... to see where it's at in the morning.
B
47
S
15
G
3
Posts: 201
Reputation: 4,625

Post » Fri Jan 16, 2015 3:31 pm

Here's some basic benchmark scenes to compare box2d with chipmunk. Both give me very similar fps & cpu readings but I didn't leave them running for long. A noticable difference between the two is that chipmunk ignores the size of the sprites when applying forces; with c2's default physics you can see that larger sprites lag behind as you move the mouse around.
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 » Fri Jan 16, 2015 5:50 pm

mattb wrote:A noticable difference between the two is that chipmunk ignores the size of the sprites when applying forces; with c2's default physics you can see that larger sprites lag behind as you move the mouse around.

Good to know- I hate how the box2d implementation messed with the mass based upon sprite size. If you set an objects mass, it should stay that value regardless of the scale of the sprite.
+1 for chipmunk!

@boybacteria , cool icon!
B
41
S
19
G
65
Posts: 1,085
Reputation: 37,842

Post » Fri Jan 16, 2015 7:49 pm

Updated to version 1.3
* Fix: removed an alert left in the set mass action.
* Fix: speed expression was broken.

@mattb
I'll have to give this more thought to keep things simple. Ideally we could coose from:
layout x,y
imagepoint
relative to orientation of the object *(what's currently done)


@boybacteria
Thanks for the icon. It makes it look like a physics behavior as much as the name does. :)
edit: opps, forgot to add it. will next update for sure.

@spongehammer
That's a typo on my part. I used ^ which in js means xor instead of squared.

@Prominent
The built in physics' mass property is more like density, since the box2d mass is calculated with the area of the shape.

You can do the same in this behavior by setting the mass to with the area expression.

@mattb
Here's a capx that sets the mass based on object size.
You do not have the required permissions to view the files attached to this post.
B
91
S
31
G
103
Posts: 5,235
Reputation: 67,756

Post » Sat Jan 17, 2015 4:35 pm

I'm a bit confused on how the torque works... check out this example:

torque.capx


The one on the left is with the default physics behavior... I obviously haven't done much in this example for Chipmunk... but I'm just curious if there is anything I can do to mimic this? Note, the black dot is there for you to drag over to the spinning 'propeller' to stop it from moving.

There is no 'apply torque'.... only 'set torque'.

Ideas? Thanks!
You do not have the required permissions to view the files attached to this post.
B
47
S
15
G
3
Posts: 201
Reputation: 4,625

Post » Sat Jan 17, 2015 6:17 pm

@Nitro187
"Set torque" does what it says, it set's the torque. The only difference to apply torque is possibly adding to the torque, but you can do this with "Sprite.chipmunk.torque + something".

Here's it working with chipmunk
You do not have the required permissions to view the files attached to this post.
B
91
S
31
G
103
Posts: 5,235
Reputation: 67,756

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 3 guests