[ODE] Hovercraft?

Clay Larabie Clay Larabie" <c-larabie at rogers.com
Fri Aug 30 12:25:02 2002


Very cool.

Thanks for your complete explanation, now I understand how it could be
implemented.

The function dBodyAddForceAtPos was the missing piece of the puzzle, and of
course your example calculations will be very helpful.

Thanks again

Clay


----- Original Message -----
From: "Nate W" <coding@natew.com>
To: <ode@q12.org>
Sent: Friday, August 30, 2002 4:11 AM
Subject: Re: [ODE] Hovercraft?


> On Fri, 30 Aug 2002, Clay Larabie wrote:
>
> > > "For a hovercraft, you might try putting damped springs at each corner
> > > of the chassis."
> >
> > Can ODE be used for the springs, or is this something we'd have to
> > ourselves? For example, I looked through the documentation for "spring"
and
> > didn't find anything. Could a joint be used to do this?
>
> You could maybe use joints, but it would probably be computationally
> expensive.  Springs are pretty straightforward to implement yourself
> though.  It would go something like this...
>
>
> float SpringRate = use_trial_and_error_to_find_this
> float DesiredAltitude = this_is_up_to_you
>
> For each corner of the hovercraft
>
> Vec3 vecChassisCorner = the xyz of the corner of the chassis
> Vec3 vecGroundContact = the point on the terrain directly below
vecChassisCorner
> Vec3 vecNormal = terrain surface normal at vecGroundContactPoint
>
> // get the current altitude as a scalar
> Vec3 vecDistance = vecChassisCorner - vecGroundContact
> float Altitude = vecDistance.GetLength ();
>
> // if the craft gets below the desired altitude, use a spring
> // to push it back, in the direction of the terrain normal.
>
> if (Altitude < DesiredAltitude)
>
> // compute the spring force
> Vec3 vecSpringForce = vecNormal * (Altitude - DesiredAltitude)
> vecSpringForce *= SpringRate
>
> // apply the spring force
> dBodyAddForceAtPos (vecSpringForce, vecChassisCorner)
> end if
> end for
>
> If would be even better to find the point on the surface closest to
> vecChassisCorner rather than what's directly below it, but that is, as
> they say, left to the reader. :-)
>
> It might also be a good idea to add damping - to reduce the spring force
> by some value proportional to the vertical component of the velocity of
> the hovercraft's chassis at vecChassisCorner.  That might not be necessary
> though, I'd try without and see how it goes.
>
> One last thing - you probably don't want to apply any springs if the
> hovercraft flips inverted.  Perhaps the normal of the bottom of the
> hovercraft should figure into those calculations somewhere... or the angle
> between the hovercraft normal and the terrain normal.  I dunno... mess
> with it and see what happens. :-)
>
> I hope this helps.
>
> --
>
> Nate Waddoups
> Redmond WA USA
> http://www.natew.com
>
>
> _______________________________________________
> ODE mailing list
> ODE@q12.org
> http://q12.org/mailman/listinfo/ode