ALife , Sodaplay & Springs

My research is in ALife and I have used ODE and Vortex so I have some familiarity with physics engines. Currently I am looking to move away from “joint” driven creatures to “spring” driven creatures. An example of this are the creatures of sodayplay: http://www.sodaplay.com/.

I am hoping someone might be able to give me some advice on this before I begin to tackle this problem. It seems to me that slider joints would be insufficient and ODE doesn’t seem to have “multi-point tension spring” which seem to be what is used in Sodayplay (http://www.sodaplaycentral.com/articles/tension1.php)

I would be very interested in hearing anything anyone would have to offer on this.

Thanks,
RDL

There is a new java.net article on this particular subject:

“Making Fluid 3D Creatures with JOGL”
http://today.java.net/pub/a/today/2004/07/20/fluidiom.html

… and for the graphics people check out this “photon soup” renderer in java:

http://www.cpjava.net/photonproj.html

Thanks. That is pretty interesting. I am looking over the source code now to see if it would be easier to use java ODE or try to integrate this.

Oh, one more thing. If I was to implement this in odejava would I need to use the lowlevel api or would there be enough there to use the highlevel api?

The highlevel API is basically an O-O wrapper for the low level API. It’s even possible to mix and match (with care). I would recommend using the High Level API. If there is anything missing or that could be done better, code it and send us the diff :slight_smile:

Will.

You can apply forces to bodies at positions relative to those bodies. Such positions would correspond to the points where the spring attaches itself to the body. Use the low level api, namely Ode.dBodyGetRelPointPos, to transform each attachment point of a spring to global coordinates. You can then find the length of the spring based on these two points, and use it in your spring equation.

Once you have the force from the spring equation, you simply get a vector from one attachment point to the other, normalise and then scale by the amount of force induced by the spring. Add the forces to each body relative to the attachment points.

Here is a prototype solution for converting a point from body space to global space:
public static void getBodyToWorldPoint(Body body, Tuple3f inBodyPoint, Tuple3f outWorldPoint) { SWIGTYPE_p_float _pf = Ode.new_floatArray(3); Ode.dBodyGetRelPointPos(body.getBodyId(), inBodyPoint.x, inBodyPoint.y, inBodyPoint.z, _pf); outWorldPoint.x = Ode.floatArray_getitem(_pf, 0); outWorldPoint.y = Ode.floatArray_getitem(_pf, 1); outWorldPoint.z = Ode.floatArray_getitem(_pf, 2); Ode.delete_floatArray(_pf); }

One thing I am thinking about with the “standard” spring solution is that this is a “cellular” system and not a particle system and I would like the “springs” to act kind of like muscles. One thing I noticed with regular springs implementations is that if I have something like a box, where each vertex is a point and each edge is a spring you also need to apply springs on the cubes diameter so that it doesn’t collapse.

Joints are different however because they kind of weld the connecting objects along an axis. I would like to keep that (doesn’t matter if they spin) but I would like them to have some push-pull flexibility as well as some “bending” capability.

Thanks
RDL

P.S. I am on a bit of a tight deadline her as I am trying to get my implementation in a suitible form as I would like to show what I have to some people at the upcomming alife conference.

That said, if anyone wants to make some extra money I would gladly pay because I know this is going to take me awhile to figure out!

Thanks,
RDL

[quote]One thing I am thinking about with the “standard” spring solution is that this is a “cellular” system and not a particle system and I would like the “springs” to act kind of like muscles. One thing I noticed with regular springs implementations is that if I have something like a box, where each vertex is a point and each edge is a spring you also need to apply springs on the cubes diameter so that it doesn’t collapse.

Joints are different however because they kind of weld the connecting objects along an axis. I would like to keep that (doesn’t matter if they spin) but I would like them to have some push-pull flexibility as well as some “bending” capability.

Thanks
RDL
[/quote]
To keep the springs from being loose, all you have to do is add not only a force as in the regular spring impl, but also a torque at the point where the spring is attached to a body.

When you setup your physical model, save the vector direction or “normal” that the spring attaches to each body. Then after each step calculate the actual vector between the spring’s two attachements points, and using the saved vector, you can apply an appropriate torque which will try to twist the bodies back into allignment.

there’s another topic here related to spring-based creatures. they’ve actually been evolved with a simple genetic algorithm to run like the wind. :slight_smile:

http://www.java-gaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=jogl;action=display;num=1095590540