QtCraft API C++ classes QML types Handbook

QcLocalAnimation Class

Animation of the local player between server updates: the timers of the arm swing, using, switching the held item and landing (in ticks, negative while not running) and the distance walked for the stride. More...

Header: #include <clientcore/player/QcLocalAnimation.h>

Public Functions

QcHandTimers handTimers(double alpha) const
void hurt(std::optional<float> from, float viewYaw)
QcHurtTilt::Tilt hurtTilt(double alpha) const
QcEntityPose localPose(double alpha, const QcPrediction &prediction, double drawProgress) const
void stepped(const QcEntityMotion &previous, const QcEntityMotion &current)
void swing()
void tick(QcItemId held, bool mining, QcSwingSpeed speed, double draw)
void use()

Static Public Members

const int deathTicks
const int hurtTicks
QcEntityPose poseOf(const QcClientEntity &entity, double alpha, const QcContentRegistry *content = nullptr)
const int swingTicks

Detailed Description

The poses for the renderer come from these timers and the predicted motion; poseOf() builds the pose of a mirrored entity the same way.

Member Function Documentation

QcHandTimers QcLocalAnimation::handTimers(double alpha) const

Returns the progress of the hand animations alpha into the current tick.

void QcLocalAnimation::hurt(std::optional<float> from, float viewYaw)

A fresh hit hurt the player from the world yaw from (none: without a direction) while they looked along viewYaw: starts the hurt time (decision E-971).

QcHurtTilt::Tilt QcLocalAnimation::hurtTilt(double alpha) const

Returns the tilt of the view alpha into the current tick (none outside the hurt time).

QcEntityPose QcLocalAnimation::localPose(double alpha, const QcPrediction &prediction, double drawProgress) const

Returns the pose of the local player from prediction; alpha interpolates within the current tick, drawProgress is the drawn launcher's (QcClientLauncher::progress).

[static] QcEntityPose QcLocalAnimation::poseOf(const QcClientEntity &entity, double alpha, const QcContentRegistry *content = nullptr)

Returns the pose of the mirrored entity from its server state and client timers, alpha into the current tick. Its draw follows the curve of the launcher it holds in content (QcEntityPose::drawProgress, decision E-987); without one it shows fully drawn.

void QcLocalAnimation::stepped(const QcEntityMotion &previous, const QcEntityMotion &current)

After a predicted step on foot from previous to current: the distance walked and a landing.

void QcLocalAnimation::swing()

Starts the arm swing (a click's short one) or the use animation.

void QcLocalAnimation::tick(QcItemId held, bool mining, QcSwingSpeed speed, double draw)

Advances the timers by one tick. Holding another item held (qcNoItem: empty hand) starts the switch; mining keeps the arm swinging, one swing after the other without a gap. speed sets the length of the swings that start from now on (decision E-881); a running one keeps its length. draw is the power of the drawn launcher (negative when none): the hand comes to it or leaves it (QcHandTimers::aim, decision E-984); another item ends that at once.

void QcLocalAnimation::use()

Starts the use animation.

Member Variable Documentation

const int QcLocalAnimation::hurtTicks

The hurt time of the own player in ticks: the red flash of the figure and the tilt of the view, as long as the flash of others (decision E-971).