QtCraft API C++ classes QML types Handbook

QcPlayerInput Struct

Movement intent for one simulation tick, sent from client to server. More...

Header: #include <common/physics/QcPlayerInput.h>

Public Functions

bool sprints() const

Public Variables

quint8 flySpeed
bool flying
float forward
bool jump
float pitch
QcVec3 push
quint32 sequence
bool sneak
float speedFactor
bool sprint
float strafe
bool usingItem
float yaw

Static Public Members

const quint8 maxFlySpeed
const quint8 minFlySpeed
const quint8 normalFlySpeed
float qcWrappedYaw(float degrees)

Detailed Description

Member Function Documentation

bool QcPlayerInput::sprints() const

Returns whether this input sprints: the wish to, moving forward and no item in use (decision E-986). Sneaking is not looked at: a walker's sneak goes first in QcEntityMotion::stepPlayer, the server checks it for the figure, and a flyer's sneak only descends.

Member Variable Documentation

bool QcPlayerInput::flying

The player wants to fly (toggled by a double tap of jump); only granted where the game mode allows it, and dropped by the physics on landing.

bool QcPlayerInput::jump

The player wants to jump (swim up, climb, fly up).

QcVec3 QcPlayerInput::push

The push of the creatures the player overlaps (decision E-882), a horizontal velocity in m/s added to his move, set like speedFactor by the side that steps the input: the server from its creatures, the client from those it knows (QcPushBodies). Never sent.

quint32 QcPlayerInput::sequence

Numbers the inputs of a connection; the server acknowledges them (PlayerState).

bool QcPlayerInput::sneak

The player wants to sneak (fly down).

float QcPlayerInput::speedFactor

The factor of the status effects on the player's speed (slowness, decision E-838), set by the side that steps the input: the server from the player's effects, the client from those the server told it. Never sent.

bool QcPlayerInput::sprint

The player wants to sprint.

bool QcPlayerInput::usingItem

The player holds an item in use (draws a bow) in this input (decision E-986): he moves at QcPhysics::usingItemFactor of his speed and does not sprint. Sent, and the server steps the input with it even when it knows of no draw, so that client and server agree on every input; it also slows a player it knows to draw when this is not set.

Related Non-Members

float qcWrappedYaw(float degrees)

Returns degrees wrapped into [0, 360), non-finite values give 0. Adding 360 to a tiny negative remainder of fmod rounds to exactly 360 in float; that case maps to 0, so the result is always below 360.