[ODE] Rotation troubles

Nicholas Francis nicholas at uti.is
Sat Dec 27 16:41:35 MST 2003


Thanks for the tip. I played around with spring/damping, and they work  
quite nice, except for:

* Du to the low force applied when the target is 'close' to being  
right, it takes a very long time to get the last 2-3 degrees of  
rotation right
* On the flip side of the above, the rotations get very fast if the  
target direction is far away (as the spring gets very strong).

Correcting the spring/damper constants to fix one of the above problems  
naturally made the other one worse. I tried adding a falloff to the 1-d  
(by raising it to, say, 0.5) in order to compensate, but it did not  
solve the problem.

We're already using sping/dampers for the camera control, and for that  
it works great. However, here the varying strength of the spring makes  
the object being rotated look either too heavy or too light. I think  
the reason it works for cameras, but not helicopters is that  
helicopters have a certain mass (to say the least), hence when they  
turn too fast it feels wrong in a way a camera never will. At the same  
time, an experienced pilot will certainly 'drive' the helicopter just  
as hard when 10 degrees away from a correct shot as when 90 degrees  
away.

Any other suggestions, or do I need to get up to speed on my math  
skills?

TIA,
Nicholas
On Dec 25, 2003, at 11:40 PM, Ruud van Gaal wrote:

> ...
>> As an example of what we're trying to accomplish with this,
>> imagine an
>> ODE/AI controlled enemy helicopter. We want it to 'do its
>> best' to keep
>> the gun (=forward direction) aligned with the player, and the
>> having a
>> limited rotational power to accomplish this with. This
>> implies that the
>> target position will change continously.
>
> I always like to take the blunt approach, trying to reason from a human
> point of view. In this case, you want to target the enemy target (or
> whatever target), and rotate there but not overcook it if you're  
> already
> rotating fast.
>
> Make a sort of damper system:
> - the enemy helicopter offset becomes T: T=enemyPos-playerPos
> - the current direction is P. P is just the gunDirection
> - Normalize T. P is already normalized.
> - Take a dot product d=T dot P which tells you how close you are to  
> your
> ultimate target
> - If d~0, it's good enough, exit here
> - Otherwise take a cross between T & P to determine which side to  
> rotate to
> (in body coordinates)
> - Use a spring/damper formula to determine the response:
>   Torque=(1-d)*k + playerYawVel*c_damper
>   Where k is the spring constant, pulling the heli towards the desired
> direction,
>   and c_damper is a damper constant that takes into account any current
> rotation.
>   1-d will get close to 0 when the target is matched.
> - Experiment with k and c_damper.
>
>> So far, I can easily get the helicopter to turn towards the
>> player, but
>> it overshoots. I tried to calculate the rotation of the
>> helicopter in 1
>> second,
>
> This would work much better if you determine the overshoot per physics  
> step.
> So not 1 second, but your time period.
>
> I use a system similar as above in a helicam tracking a car. SMD  
> systems
> (spring-mass-damper) have well-defined properties if you want to  
> calculate
> c_damper values instead of experimenting (for under-, over- and perfect
> damping).
>
> Hope that helps,
> Ruud
> _______________________________________________
> ODE mailing list
> ODE at q12.org
> http://q12.org/mailman/listinfo/ode
>


Nicholas Francis
------------------------------------------------------------------------ 
-------
Scheduling fascist - Over The Edge Entertainments



More information about the ODE mailing list