[ODE] Questions about representing motion in ODE

Geoff Carlton gcarlton at iinet.net.au
Sun Mar 12 15:48:27 MST 2006


I'd start a very large drag effect for velocity and turning, so if there 
are no external forces the sub stops its movement fairly quickly.

You either need apply an acceleration force which diminishes with 
increasing velocity, or a drag force that increases with increasing 
velocity.  That way, a a body reaches a "top speed", rather than 
allowing the velocity to reach infinity.  Controlling this factor is the 
key to having the acceleration-based game have that normal fun feeling.  
Players are used to a velocity based control scheme, so too much 
momentum and acceleration can feel strange.

The turning depends on the style of game.  If you want players to move 
in 3d, with forward being the sub's forward, then apply the thrust force 
along the sub's forward axis and turn with small torques.

For a more linear style game, have the left and right keys apply small 
translational forces so the subs keep their facing and "strafe".  In 
this latter case, you will need to deal with the case where sub's facing 
is turned away from its normal one, and automatically turn it back 
(similar to the warthog in Halo - you hold down forward and it works out 
how to turn to get there).

Geoff


Jean-Sebastien Guay wrote:
> Hello,
>
> This is my first time working with a physics library. We're making a small game
> for a graphics programming class. Without explaining the whole game, I think it
> will suffice to say that it has to do with submarines, in an "arcade" kind of
> way (picture a kind of "Mario Kart" but with submarines instead of go-karts).
>
> I'm having trouble representing the submarine's movement correctly using ODE,
> and would like some advice on how to make it fun (even if it isn't totally
> correct for a submarine). At first, to test it out, I just applied a force when
> the player pressed the "accelerate" or "forward thrust" key. But that just makes
> me go in one direction forever and I have to counter that force with an opposite
> one to stop (which is physically what I asked ODE to do, but not what I want -
> it's too hard to control in an "arcade" type of game). I also tried to reset
> the force in the direction the sub is going with something like this:
>
> // SetForce calls dBodySetForce with my application's Vector class
> // GetForce calls dBodyGetForce and converts the dVector3 to my application's
> //   vector class
> // m_Direction is a unit vector representing the sub's direction
> SetForce( m_Direction * GetForce().GetLength() );
>
> I thought that it would just go at the same speed but always in the direction
> the sub was pointing, but that didn't work. (It would just continue to go in
> the direction I had given at the AddForce() call, when accelerating)
>
> >From your experience, how would you model something like that in ODE? I'd prefer
> it were a simple way. I haven't made wrappers for the joints yet either so I'd
> prefer not to use them for now.
>
> Also, is there a better way to model the sub's rotation? For now, I just get yaw
> and pitch from reading the mouse and change m_Direction (and other vectors) to
> reflect that, but would it be better if I applied for example a torque or
> something like that? How would I do that to get what I want?
>
> Thanks in advance,
>
> J-S
> --
> ______________________________________________________
> Jean-Sebastien Guay     jean-sebastien.guay at polymtl.ca
>                          http://whitestar02.webhop.org
> _______________________________________________
> ODE mailing list
> ODE at q12.org
> http://q12.org/mailman/listinfo/ode
>
>
>   


More information about the ODE mailing list