[BEHAVIOR] Chipmunk Physics

Post your completed addons to share with the community

Post » Wed Jan 07, 2015 8:26 pm

Is there a way to set linear or angular damping per object?

It's not a built-in feature of the chipmunk library but you can do it by either:
1. setting the velocity to say (velocityX*0.9, velocityY*0.9) where 0.9 is a value from 0 (total damping) to 1 (no damping)
2. applying a force in the opposite direction as the velocity or angleOfMotion.

Prevent rotation is another handy feature that's missing

True. I just need to find a good way to work that in.
B
92
S
32
G
107
Posts: 5,280
Reputation: 69,971

Post » Sun Jan 11, 2015 8:22 am

I am curious, why did you decide to use chipmunk? Was there a defining feature that made it more feasible to add to construct2 than box2d?

I have been looking through chipmunk and comparing box2d to it. I like all the work you have done, but it seems that some of the features (such as this frame jointing and position setting ) are more a product of how the behavior is written than the physics engine. Is this correct?
Image
B
33
S
11
G
2
Posts: 564
Reputation: 5,153

Post » Sun Jan 11, 2015 12:02 pm

It was kind of an arbitrary decision, either library would've worked. Box2d is already used in C2 and CC so I thought I'd try chipmunk instead. It's due to some bias too since I've only coded with chipmunk and my only exposure to box2d was the behaviors, which have some quirks that make then unwieldy sometimes. But to be fair the quirks are probably due to the way the behavior was written instead of how box2d was written.

The actions to add joints are pretty much the same as the js functions to add joints. The only thing I added to them was the ability to use either rectangular or polar offsets.
B
92
S
32
G
107
Posts: 5,280
Reputation: 69,971

Post » Mon Jan 12, 2015 9:36 am

@R0J0hound

There seems to be some issue with the sleeping check. See the attached capx. It does seem to work sometimes but not others.

Thanks
You do not have the required permissions to view the files attached to this post.
B
48
S
16
G
9
Posts: 1,097
Reputation: 11,195

Post » Mon Jan 12, 2015 10:52 pm

Updated to version 1.2:
* Bugfix: Once a force was applied to an object it could never go to sleep. @spongehammer thanks for the bug report.
* Added actions and expressions for more control over sleeping:
- sleepTimeThreshold, the amount of time an object has to be idle before going asleep
- idleSpeedThreshold, the maximum speed an object can be going and still be considered idle.
*Added "Prevent rotation" property that keeps objects from rotating when colliding. (Basically Infinite inertia) @mattb
- Also added an action to set it and a condition for it.
* Added conditions "is enabled" and "is immovable" as well.
* fixed the mass and inertia expressions to return correct values when the object is immovable or unrotatable.

-cheers
B
92
S
32
G
107
Posts: 5,280
Reputation: 69,971

Post » Tue Jan 13, 2015 8:46 am

Excellent work as always :) . Thanks
B
48
S
16
G
9
Posts: 1,097
Reputation: 11,195

Post » Tue Jan 13, 2015 5:42 pm

yay! looks like some nice additions
B
43
S
19
G
65
Posts: 1,105
Reputation: 37,949

Post » Tue Jan 13, 2015 5:45 pm

@R0J0hound , btw.. is there anything specific stopping you from tilemap support? or are you just unsure how you want to implement it yet?
B
43
S
19
G
65
Posts: 1,105
Reputation: 37,949

Post » Wed Jan 14, 2015 3:37 am

@Prominent
It's not as trivial to add support for as most of the other features added so far, but that's not really stopping it. It just may require a bit more time to do once I start implenting it.
B
92
S
32
G
107
Posts: 5,280
Reputation: 69,971

Post » Wed Jan 14, 2015 11:20 am

ROJO is best hound around here thanks rojo
B
250
S
39
G
15
Posts: 1,953
Reputation: 40,623

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 2 guests