[BEHAVIOR] Chipmunk Physics

Post your completed addons to share with the community

Post » Wed Feb 04, 2015 8:55 pm

The physics is updated every frame. 1/30 just means the amount of time simulated in a frame.

It looks like it's just a difference between the libraries. It may be corrected in a newer version of the chipmunk library since it changed it's collision detection code. Unfortunately there isn't an updated js port.
B
94
S
33
G
117
Posts: 5,392
Reputation: 75,345

Post » Thu Feb 05, 2015 2:39 am

@mattb , you might be able to move it out based on its' collision depth to negate the overlapping.
B
48
S
23
G
66
Posts: 1,144
Reputation: 39,059

Post » Thu Feb 05, 2015 3:21 am

@R0J0hound , is there an explanation of the jointimpulse expression? Is this the tension between joints attached to two objects? I'm trying to figure out how to get the tension or force of an object pulling on another. Maybe jointimpulse will do it?

edit: i found this in the chipmunk docs "The most recent impulse that constraint applied. To convert this to a force, divide by the timestep passed to cpSpaceStep(). You can use this to implement breakable joints to check if the force they attempted to apply exceeded a certain threshold."
Would I divide the jointimpulse by 1/30 ? That would give me a larger value, which wouldn't make sense. Or maybe it means to multiply it?
B
48
S
23
G
66
Posts: 1,144
Reputation: 39,059

Post » Fri Feb 06, 2015 6:22 am

That should be right. By definition impulse=force*time. So to get the force dividing by the time (1/30).
B
94
S
33
G
117
Posts: 5,392
Reputation: 75,345

Post » Fri Feb 06, 2015 8:56 am

@R0J0hound thanks.. When I apply an impulse or force on an object, how would I apply it at a layout x,y coordinate? The only options are polar and rect, which I assume are relative to the object (rect is relative to a non-rotated state?). If I have a joint attached to an object and want to apply a force on the object at the location of the joint, there doesn't appear to be an intuitive way to do this.
B
48
S
23
G
66
Posts: 1,144
Reputation: 39,059

Post » Fri Feb 06, 2015 6:00 pm

Right, forces and impulses are relative to the object, object rotation is ignored. If you want a force/impulse to a particular layout position use polar with the angle(self.x,self.y, posX, posY) expression.
B
94
S
33
G
117
Posts: 5,392
Reputation: 75,345

Post » Fri Feb 06, 2015 8:02 pm

@R0J0hound , Oh okay, I see now. For some reason I didn't realize I could do that. Thanks!
I've been getting more comfortable with the behavior. Haven't really ran into any major issues. But I have noticed that if I leave a game running for a while, it slows down a lot, and if I restart the layout everything becomes quick again. Not sure why it would do that. I know someone else mentioned it in this thread previously.
Btw, Is the pre-step condition only useful for negating gravity?
B
48
S
23
G
66
Posts: 1,144
Reputation: 39,059

Post » Fri Feb 06, 2015 8:10 pm

@R0J0hound , also, can you tell me why commenting out this pin joint has the shown effect?
I don't understand why the pin joint is needed.
You do not have the required permissions to view the files attached to this post.
B
48
S
23
G
66
Posts: 1,144
Reputation: 39,059

Post » Fri Feb 06, 2015 9:04 pm

@R0J0hound thanks for this wonderful plugin.
Last edited by iceangel on Tue Feb 10, 2015 7:54 am, edited 1 time in total.
B
159
S
27
G
17
Posts: 916
Reputation: 32,675

Post » Sat Feb 07, 2015 6:08 pm

is the angular velocity implemented in this version?
quoting the chipmunks website documentation:
"The surface velocity of the object. Useful for creating conveyor belts or players that move around."

seems like that could be very useful
B
3
Posts: 9
Reputation: 193

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 1 guest