[BEHAVIOR] Chipmunk Physics

Post your completed addons to share with the community

Post » Mon Nov 23, 2015 4:11 am

Quick feedback, specifficaly for android mobiles, through cordova on Intel Xdk. The chipmunk physics has nearly 80% better performance than the default physics behavior. Almost no lagging, more fluid movement and gravity reactions.

Tested with same game contraptions at the same mobiles, with apk made with Intel Xdk crosswalk android. I'm not in pc right now but when i do, i can send details if you want.
B
16
S
6
G
1
Posts: 10
Reputation: 1,177

Post » Sat Nov 28, 2015 12:55 pm

Hey @r0j0hound
I just want you to ask if there is a possibility to make a kinematic body with chipmunk.
Not like the previous examples mattb give (the one with the platforms) i mean is there a chance to add to this behavior set physics bodies kinematic and do the trick. i am asking that because I am working with box2d and @ruskul managed to add set body kinematic to box2d .js file and you can apply other behaviors to kinematic body like sine and works pretty well specially if there is other physics bodies with joints on it (they dont break and acts like it should be) But Box2d is very slow and has a lot of limitations compared to chipmunk .
Is there a chance to see something new on chipmunk? Or this chapter is close for you.
Great behavior by the way .Thanx .
B
36
S
15
G
1
Posts: 59
Reputation: 3,441

Post » Sat Nov 28, 2015 7:10 pm

@saour
Chipmunk2d doesn't really have kinematic bodies like box2d.
Wouldn't setting the collision to none, giving the object a high mass, and canceling the gravity like below work?

sprite: chipmunk: on pre step
> sprite: chipmunk: apply force rect(0,-self.chipmunk.gravity*self.chipmunk.mass)

I realize it doesn't match box2d's defination exactly...
A kinematic body moves under simulation according to its velocity. Kinematic bodies do not respond to forces. They can be moved manually by the user, but normally a kinematic body is moved by setting its velocity. A kinematic body behaves as if it has infinite mass, however, Box2D stores zero for the mass and the inverse mass. Kinematic bodies do not collide with other static or kinematic bodies.

Namely, not responding to forces. You can set the mass to be infinite with events but there is a NaN issue with the library when doing that so a very high mass is better.
B
92
S
32
G
109
Posts: 5,294
Reputation: 70,999

Post » Sat Nov 28, 2015 9:27 pm

@saour , also in addition to what r0j0hound said, if you need to move it, you can use a separate object to position the other one that shouldn't be affected by forces. r0j0hound helped me with this in the past, here is a snapshot of how I handle it:
the two use different layering groups so they don't collide with each other, and I turn rotation off on the object that follows the other, and give it a high mass value too. Works perfectly.
Image
B
45
S
21
G
65
Posts: 1,118
Reputation: 38,227

Post » Sat Nov 28, 2015 10:37 pm

Hey @R0j0hound and @Prominent
Really really nice approach of the Kinematic.
It works really smooth specially with the sine behavior .
B
36
S
15
G
1
Posts: 59
Reputation: 3,441

Post » Sun Dec 13, 2015 7:36 pm

Message: Paramonov can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
http://www.youtube.com/watch?v=vLp_BO3AUAs
Image
Image
Hi, I need help on the joints. As you can see in the screenshots, I create something like microorganism fluid forms. At this stage, I ran into a problem: the cells repel each other and do not want to live together as a single substance. What additional commands should be used? How can I do to cells could be added, the body grow, and being lived in one form? In principle, it does not matter, it will be liquid or not, the main thing - is that growth is on the cells, as well as destruction.

Still I am trying to make sure that they are not repelled by each other like mad, but do not pass through each other. Any idea how to do it?
Sorry for my English, I myself am from Russia.
B
7
S
2
Posts: 13
Reputation: 710

Post » Sat Dec 19, 2015 11:13 pm

I'm having trouble adding the ability to drag an object. I have it so that when mouse down to position an object and have it with a joint to another object that will be dragged, but when I drag it through a wall, the joint gets repositioned so that the objects become separated(joined from a distance), even when I move the mouse back out of the wall.
Any ideas on how to fix?
B
45
S
21
G
65
Posts: 1,118
Reputation: 38,227

Post » Sun Dec 20, 2015 7:03 pm

@Prominent
It's hard to say without a capx. It would be odd if the joint got offset but I suppose it would depend on the joint type.

Is the dragging similar to this? (from the first post)
https://dl.dropboxusercontent.com/u/542 ... test2.capx
B
92
S
32
G
109
Posts: 5,294
Reputation: 70,999

Post » Sun Dec 20, 2015 8:47 pm

ahhh! I think I know what is the issue. Seems like when the pointer object(object being positioned to the mouse) is not set to immovable(in the physics), then the joint position gets altered when trying to drag through an object.. But if I set the pointer to immovable, then the joint stays in correct position even if I drag stuff into an object.
Not sure why the difference occurs depending on that setting, but I might be able to work with this now.
So to recap, yeah- I had been doing it like that example, but I didn't have the pointer set to immovable. Having it movable produces weird results when dragging stuff through immovable objects.
B
45
S
21
G
65
Posts: 1,118
Reputation: 38,227

Post » Mon Dec 21, 2015 6:13 am

Now I'm having another issue.. Seems when I try to join objects together using a gear joint and a pivot, one of the objects turns 360 degrees before it settles back to the position it should be in.
Not sure what I'm doing wrong.. It doesn't happen all the time, but seems to depend on orientation of the objects. Is there anything I need to keep in mind when doing this? like should the angles be between 0-360, or -180-180?

edit: here's an exmaple: http://1drv.ms/1YvddfG
Seems like setting the angle before joining will mess it up. Any way to get around this?
Last edited by Prominent on Mon Dec 21, 2015 6:45 am, edited 1 time in total.
B
45
S
21
G
65
Posts: 1,118
Reputation: 38,227

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 5 guests