QtCraft API C++ classes QML types Handbook

QcMobHover Namespace

How hovering creatures move (QcMobDefinition::hover, decision E-839; the Kjut): without gravity, at their hover height above the ground or the liquid below them (bobbing gently), lower under a low ceiling and never higher than their highest hover above the ground; they fly towards where their brain wants to go, rise over a wall in their way and turn slowly to face where they go. More...

Header: #include <server/mobbrains/QcMobHover.h>

Classes

struct Course
struct Room

Variables

const double ceilingGap
const double climbHeight
const int climbTicks
const double liftFade
const double maxVerticalSpeed
const double steerRate
const double verticalGain

Functions

void fly(QcCreature &mob, const QcMobDefinition &definition, const QcBlockAccess &world, const QcMobHover::Course &course, double seconds)
QcVec3 orbitPoint(quint32 child, const QcVec3 &parentFeet, double parentHeight, const QcFamilyDefinition &family, double seconds)
QcMobHover::Room roomAt(const QcBlockAccess &world, const QcVec3 &feet, double height, double reach)
QcMobHover::Course towards(const QcCreature &mob, const QcVec3 &point, double speed)
float turned(float from, float to, double degrees)
double vertical(double velocity, double rise, bool knockedBack)
double wantedFeet(const QcCreature &mob, const QcMobDefinition &definition, const QcMobHover::Room &room, double seconds)

Detailed Description

Children of a family that chase nobody orbit their parent (orbitPoint).

Classes

class Course

What a hoverer does this tick: the steering of its brain (a horizontal wish and a speed) and, for an orbiting child, the height its feet keep instead of the hover height. More...

class Room

The floor (top of the first block with a collision box or a liquid below the middle of the body) and the ceiling (bottom of the first block with a collision box above the head) around a body whose feet are at feet; no floor within reach lies reach below the feet. More...

Variable Documentation

const double QcMobHover::ceilingGap

Room left between the head and a ceiling.

const double QcMobHover::climbHeight

How far above its height a hoverer rises after a wall stopped it.

const int QcMobHover::climbTicks

Ticks a hoverer keeps rising after a wall stopped it.

const double QcMobHover::liftFade

How fast a speed upwards beyond the one towards its height fades (a split's leap), in m/s²: slower than gravity, so a child split off visibly pops up.

const double QcMobHover::maxVerticalSpeed

The highest vertical speed in m/s.

const double QcMobHover::steerRate

How fast the velocity follows the wish (share per second).

const double QcMobHover::verticalGain

Vertical speed per metre off the wanted height in 1/s.

Function Documentation

void QcMobHover::fly(QcCreature &mob, const QcMobDefinition &definition, const QcBlockAccess &world, const QcMobHover::Course &course, double seconds)

One tick of mob, a hoverer of the kind definition, on course at the clock seconds (the bob): it steers, keeps its height and moves through world; a knocked-back one does not steer, one without a mind floats where it is.

QcVec3 QcMobHover::orbitPoint(quint32 child, const QcVec3 &parentFeet, double parentHeight, const QcFamilyDefinition &family, double seconds)

Returns where the child child orbits its parent with its feet at parentFeet at seconds: around the middle of the parent's body (parentHeight), on a radius of family and with a phase and direction of its own (from its id).

QcMobHover::Room QcMobHover::roomAt(const QcBlockAccess &world, const QcVec3 &feet, double height, double reach)

Returns the room in world around a body of height whose feet are at feet, looking for a floor within reach.

QcMobHover::Course QcMobHover::towards(const QcCreature &mob, const QcVec3 &point, double speed)

Returns the course of the child mob towards its orbit point point (its feet), no faster than speed.

float QcMobHover::turned(float from, float to, double degrees)

Returns from turned towards to by at most degrees (yaws in degrees).

double QcMobHover::vertical(double velocity, double rise, bool knockedBack)

Returns the vertical speed of a hoverer this tick from velocity the tick before and rise, the speed towards its height: a speed upwards beyond rise (a split's leap) fades (liftFade), otherwise it follows rise; while knockedBack it falls with gravity, but at most at the speed rise would sink it and never while below its height.

double QcMobHover::wantedFeet(const QcCreature &mob, const QcMobDefinition &definition, const QcMobHover::Room &room, double seconds)

Returns where mob, a hoverer of the kind definition in room, wants its feet this tick: its hover height above the floor with the bob at seconds, higher while it climbs, below the ceiling, never above its highest hover.