QtCraft API C++ classes QML types Handbook

QcAnimator Namespace

Turns a pose into bone rotations for skeleton models and into the first-person hand motion. More...

Header: #include <clientcore/figures/QcAnimator.h>

Classes

struct BodyPose
struct BoneRotation
struct HandPose

Variables

const QcVec3 driverShoulder
const double fullSwingSpeed
const double maxLegSwing

Functions

QcAnimator::BodyPose animateBody(const QcEntityPose &pose, double time)
QcAnimator::HandPose animateHand(const QcEntityPose &pose, double time, const QcHandTimers &timers)
double legSwing(double walked, double speed, double legLength)
double swingLift(double progress)

Detailed Description

Pure functions of their inputs, so animations are deterministic and testable.

Classes

class BodyPose

The rotations of a skeleton model's bones and of its whole body in one frame. More...

class BoneRotation

Rotation of a bone around its pivot in degrees. More...

class HandPose

Where the first-person arm and held item sit relative to their rest position, in the camera's frame (x right, y up, z backwards) in metres, and how far arm and item are turned together about the shoulder (degrees; QcHandSwing::Angles). More...

Variable Documentation

const QcVec3 QcAnimator::driverShoulder

The right shoulder of the humanoid figure (its arm's pivot) above its feet; the left one mirrored. The rowing arms reach from there to the paddle grips.

const double QcAnimator::fullSwingSpeed

Speed in m/s from which legSwing() swings the legs by maxLegSwing.

const double QcAnimator::maxLegSwing

Largest leg swing of legSwing() in degrees.

Function Documentation

QcAnimator::BodyPose QcAnimator::animateBody(const QcEntityPose &pose, double time)

Returns the bone rotations of a figure in pose; time is a free-running clock in seconds for idle motion.

QcAnimator::HandPose QcAnimator::animateHand(const QcEntityPose &pose, double time, const QcHandTimers &timers)

Returns the hand of the own player in pose: its swingProgress swings it (the mining loop or a click's short swing, by timers.mining), timers switch the item, land and use (placing or eating: a click's swing too); time drives the breathing.

double QcAnimator::legSwing(double walked, double speed, double legLength)

Returns how a creature of static boxes walks (decision E-888): the legs' swing in degrees (positive moves the leg forward that QcBoxLegs gives phase 1), after walked metres at speed m/s on legs legLength metres long (as drawn). One stride cycle covers 1.8 leg lengths, so short legs step quickly; the swing grows with the speed up to maxLegSwing at fullSwingSpeed and more (QcBoxLegs::maxSwing narrows it where front and hind feet would meet).

double QcAnimator::swingLift(double progress)

Returns the height of a figure's swinging arm at progress (0..1): rises quickly to 1 at swingTop, strikes down to -1 at swingBottom, and settles back to 0 at the end. The first-person hand swings by QcHandSwing.