[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.3.3 Hover

This property class, defines a hovering object when used in conjunction with ‘pcmechobject’.

Property Class Details

General Information

A Hovering object can be something like a hovercraft or a anti-gravity ship. As well as hovering your object, it will also align it to the terrain, so that as it goes down a hill, the ship will also tilt.

PID parameters

How your object corrects its height can be done by messing with 3 parameters called p_factor, i_factor and d_factor.

iPcHover->SetAngularBeamOffset (2.0, 3.0, 4.0)

Will set p_factor to 2.0, i_factor to 3.0 and d_factor to 4.0 - there is no magic formula for adjusting these values, it's just educated guesswork and playing around with them.

You may also wish to set the hovering height with iPcHover->SetHoverHeight (float)

Stopping hovering over some objects.

If you don't want hovering over a certain object then just set the flag CS_ENTITY_NOHITBEAM on that object.

You can switch off hovering entirely with iPcHover->HoverOff () and use iPcHover->HoverOn () to turn it back on. Note that angular correction will still be happening though (which will do nothing if you're resting on the ground).

Angular Correction

This refers to the object correcting its angle as it flies over terrain (facing downwards as it flies down hills).

The implementation of this is done by calculating the object's height at its center and then calculating the height away from the center. Using the differences in height and a bit of trigonmetry, you can see the angle of the object relative to the terrain.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated using texi2html 1.76.