[ODE] Using ODE to simulate a Mech game,

Jon Watte hplus-ode at mindcontrol.org
Mon Jun 28 10:08:03 MST 2004



You can use joints between bodies, and multiple collisions, at the same time. In fact, that's how most systems work (test_buggy, ragdolls, swinging ropes, ...); they all use multiple bodies, with individual collision geometries, all attached with joints.

I dont' see why you'd get "spinning" bodies at rest, unless something's adding forces continually.

If your mechs are not balanced over their feet, then they will fall over. That's why it's called a "simulation" ;-) If you need to make them more balanced, try offsetting the center of mass of various components towards the center up axis of the mech; this will make it more stable, but may make movement more "lilting".

As far as "ground clamping" goes, what does that mean? Two-bone IK to place the feet on the ground? You don't need that with ODE -- running the simulation will take care of that just by itself, because if the feet penetrate the ground, a force will be added to push them out; if not, then gravity will pull them down. (You did set up gravity, right?)

Cheers,

			/ h+


-----Original Message-----
From: ode-bounces at q12.org [mailto:ode-bounces at q12.org]On Behalf Of Orion McClelland
Sent: Saturday, June 26, 2004 8:30 AM
To: ode at q12.org
Subject: RE: [ODE] Using ODE to simulate a Mech game,


Hmm... there's something about that I don't like. Is there an easy way to do ground clamping in ODE. I would like mechs to display rigid reactions to collision, but to be able to stand in open space without spinning. Right now, I form my mech by building several parts ( body, legs, and both arms), and then join it together with constraints. The problem is that the body is offset from the head, and causes the mech to tilt. Has anyone figured out a way around something like that? I was going to just use ODE for collision, but you can't create joints if you do that, so my mech comes apart when you start rotating it.





--- On Thu 06/24, Jon Watte < hplus-ode at mindcontrol.org > wrote:

From: Jon Watte [mailto: hplus-ode at mindcontrol.org]
To: m.orion at excite.com, ode at q12.org
Date: Thu, 24 Jun 2004 15:47:45 -0700
Subject: RE: [ODE] Using ODE to simulate a Mech game,


Awesome! I think any game with mechs is not a total failure :-)

There are two ways to go:

1) Treat the mech as a player character, and use local animation 
only. That indie action mech fighter based on Torque (Dark 
Horizons: Lore, perhaps?) does this, I think.

2) Treat the mech as an actual rigidly animated body, and make it 
walk like a robot. I don't know if MechWarrior IV does this, 
but I'm pretty sure MechAssault does. Or they do a GREAT job 
of faking it :-)

You're currently trying to go route 1. If that's what you want, 
you should probably use a capsule, rather than box, because it 
collides "nicer" with the ! ground. You could give it 0 friction, 
and instead just record whether it's in contact with something, 
and apply a velocity dampening force if that's true.

Then you get the orientation of the capsule, and apply torque 
to make the capsule spin towards the identity position. Ideally, 
you also take the angular velocity into effect. Thus, assuming 
you work with triplets of euler angles / velocities, this is 
what you can do to make the capsule stand upright:

AV = get angular velocity
R = get euler rotation
R += T * AV
apply torque( -R.x * C, -R.y * C, -R.z * C )

T is a time which is a tuneable (start with 0.2 seconds, perhaps) 
and C is a constant that's also tuneable (start with 0.2 times 
your time step, perhaps).

Note that this will always bring the capsule to identity position 
which includes identity heading. Thus, you should keep the heading 
for camera and animation work as a separate quantity, not der! ived 
from the physics. Or you can try to preserve heading while making 
the other angular values trend towards 0 using the above method.


The much more interesting method would be to actually model the 
legs and torso and feet as rigid bodies, linked with joints, and 
play a walking animation on the robot. The animation would effect 
joints with some maximum amount of torque, and the walking/tunrning 
behavior would come entirely from the physical interaction with 
the ground and other obstacles.

I've been dreaming about having enough free time to actually write 
exactly that, because I believe that'd make for a cool demo (I 
probably won't ever have enough time to write an entire game on 
my own), but, you know, time...


Cheers,

/ h+



-----Original Message-----
From: ode-bounces at q12.org [mailto:ode-bounces at q12.org]On Behalf Of Orion McClelland
Sent: Thursday, June 24, 2004 3:10 PM
To: od! e at q12.org
Subject: [ODE] Using ODE to simulate a Mech game,


Hi everybody, I've been looking through the archives for a little while, and with no search function, it's a little hard to find the info I need. I am in the process of making a mech game and I'm using ODE for collision and physics. I was wondering what the best way to do this was. Currently, I just have a box around the model, and apply force to it so that it moves, but I'm having a few problems. First a mech should start and stop instantly, but friction keeps this from happening. Second, sometimes the bodies are prone to tipping when the base hits changes in elevation in the terrain. Any suggestions would be uch appreciated.








Join Excite! - http://www.excite.com
The most personalized portal on the Web! 






Join Excite! - http://www.excite.co! m
The most personalized portal on the Web! 




More information about the ODE mailing list