Generic constraints.

Discuss new features and future development.

Generic constraints.

Postby slembcke » Sun Oct 05, 2008 6:36 pm

I gave a bit of a rant in another thread (http://www.slembcke.net/forums/viewtopic.php?f=1&t=260) about my plans for world domination through constraint programming. For those of you that don't care to read it, constraints are basically like joints, but more generic.

I've been working on that a bit this weekend:
http://files.slembcke.net/temp/breakable_joints.swf

Some things to note about the video:
  • The damped springs on the vehicle are now implemented as constraints. Set it and forget it like you would with a joint.
  • All existing joint types now have the option of force limiting them. (the mouse control is implemented as a force limited pivot joint)
  • The breakable joints are fully generic and can be used with any joint type that can return it's cached impulse.
  • I finally got around to implementing the ability for joints to return their impulse magnitudes.
  • I refactored out a bunch of common constraint code into a bunch of inline functions that can be used to help make new joints or constraints.
  • You will be able to write your own joints easily. \o/
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
slembcke
Site Admin
 
Posts: 4164
Joined: Tue Aug 14, 2007 7:13 pm

Re: Generic constraints.

Postby slembcke » Sun Oct 05, 2008 6:50 pm

Oh, I suppose I should point out that I'm doing this in another branch here: http://chipmunk-physics.googlecode.com/ ... aint-spike

I changed a bunch of the project structure, so only the XCode project will compile without changes. Also, nothing is quite final yet, so take the changes with a grain of salt.

edit: wrong repository URL
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
slembcke
Site Admin
 
Posts: 4164
Joined: Tue Aug 14, 2007 7:13 pm

Re: Generic constraints.

Postby Android_X » Sun Oct 05, 2008 8:48 pm

This is sounding really good 8-) .

I'm especially looking forward to using breakable joints to create game worlds that can be destroyed/torn apart. Breakable joints should make it really easy.

I'll check it out when I get time.

Keep up the good work!
Android_X
 
Posts: 18
Joined: Wed Oct 31, 2007 7:55 pm

Re: Generic constraints.

Postby tartley » Fri Oct 10, 2008 7:56 am

This is *super* brilliant. I've been taking a break from my Chipmunk coding the last couple of months to work on the graphics for my game, and I'm just approaching a point where I can return to world/item building and Chipmunk (but now with betterer shiny.) Looking fwd to playing with this stuff very much. Thanks for all the hard work!

\o/ indeed!
Tartley - Jonathan Hartley, http://tartley.com
Using Pymunk (Chipmunk's Python bindings) for a game project:
http://code.google.com/p/sole-scion
User avatar
tartley
 
Posts: 37
Joined: Thu Jun 12, 2008 5:01 pm
Location: London, England

Re:

Postby utgarda » Sun May 10, 2009 6:49 pm

---
Last edited by utgarda on Fri May 15, 2009 4:21 pm, edited 1 time in total.
utgarda
 
Posts: 2
Joined: Sun May 10, 2009 6:25 pm

Re: Generic constraints.

Postby dieterweb » Tue May 12, 2009 2:57 am

is the constraint code in the shown repository the same as now in the cvs trunk of chipmunk?

If use already the new constraints from trunk, but I cannot get breakable joints to work.

Thomas
Visit our game Blog: http://zombiesmash.gamedrs.com or follow us on twitter: http://twitter.com/zombiesmash
dieterweb
 
Posts: 176
Joined: Fri Feb 27, 2009 7:12 am
Location: Germany

Re: Generic constraints.

Postby dieterweb » Tue May 12, 2009 3:19 am

I checked everything again, and now breakable joints are working with the trunk!
Now I need to call a ObjC Method when the joint breaks. Anybody have done this already?

---

OK got it working.

Now I have another problem: Instead of removing a constraint in the BreakableJoint preStep Function I now call a callback function. In this function I decide if the joint really breaks.
This works when I set maxForce to the same value for the breakable constraint and its delegate constraint. But as a joint will not always break, when maxForce is reached, setting a maxForce for the delegate will result in a gap between the connected parts of the joint. But when I set the maxForce of the delegate to INFINITY (so basically I don't set it), I get really strange results. When moving my body around, Chipmunk calls my break function and the gap between the joint parts is getting bigger and bigger.

Why does the maxForce of the delegate does have an influence? This is not used in the preStep of the breakablejoint where the breaking is checked, isn't it?

---

Ok, ok. Works.

The preStep function was returning before calling the prestep of the delegate even when the joint was not removed.

Thomas

Thomas
Visit our game Blog: http://zombiesmash.gamedrs.com or follow us on twitter: http://twitter.com/zombiesmash
dieterweb
 
Posts: 176
Joined: Fri Feb 27, 2009 7:12 am
Location: Germany

Re: Generic constraints.

Postby iisystems » Tue May 12, 2009 10:00 am

Thomas,

I've been looking for people working with the maxforce property (not many posts) and was wondering if this allows you to really enforce a maximum distance between bodies? At one point you said your bodies were sliding further and further apart-- and this is my problem on 4.1.0. I would like to work with the trunk code, but I don't want to waste a lot of time integrating it into my platform if there is still not a solution to this. Could you please let me know what you found with regard to maxforce-- if it really does give you a way to enforce the maximum amount a joint can stretch?

Thanks very much!

Scott
iisystems
 
Posts: 16
Joined: Tue Apr 14, 2009 2:42 pm

Re: Generic constraints.

Postby slembcke » Tue May 12, 2009 12:48 pm

Setting a max force will not help that in the least. In fact it could only make it worse as the default max force is infinite. The problem with the joints stretching is that you have a number of joints together in a chain, and to simulate the chain properly you need to use a lot of iterations. More iterations means more CPU usage.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
slembcke
Site Admin
 
Posts: 4164
Joined: Tue Aug 14, 2007 7:13 pm

Re: Generic constraints.

Postby dieterweb » Wed May 13, 2009 4:54 am

Yes, maxForce will make this worse. I assume you have pivotJoints. Even when they should not allow any distance between two parts when maxForce is unlimited, it does so and it is getting worse with lower iterations and the faster you move one body relative to the connected body.

At it seems so there is no other way to handle this.

Thomas
Visit our game Blog: http://zombiesmash.gamedrs.com or follow us on twitter: http://twitter.com/zombiesmash
dieterweb
 
Posts: 176
Joined: Fri Feb 27, 2009 7:12 am
Location: Germany

Next

Return to Features/Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron