QtCraft API C++ classes QML types Handbook

QcHoldTransform Struct

One placement of the held thing around the grip. More...

Header: #include <common/content/items/QcHoldDisplay.h>

Public Functions

bool isEmpty() const
QcHoldTransform over(const QcHoldTransform &base) const

Public Variables

std::optional<QcVec3> rotate
std::optional<QcVec3> scale
std::optional<QcVec3> translate
enum class QcHoldCategory { Tool, Weapon, Launcher, Sprite, Block, PartialBlock }
enum class QcHoldGrip { Base, Handle, Middle }
const std::size_t qcHoldCategoryCount
const std::size_t qcHoldGripCount

Detailed Description

A point of the item (a sprite one unit across, a block one unit per block edge, both relative to the grip) is scaled by scale (metres per unit), turned by rotate (degrees about Y, then X, then Z) and moved by translate (metres) in the frame of the fist: for the first person the camera's (x right, y up, z backwards), for a figure its arm's model space (the arm hanging down, the figure facing -Z). Unset fields take the level below.

Member Function Documentation

bool QcHoldTransform::isEmpty() const

Returns whether no field is set.

QcHoldTransform QcHoldTransform::over(const QcHoldTransform &base) const

Returns this transform with every unset field taken from base.

Member Variable Documentation

std::optional<QcVec3> QcHoldTransform::rotate

Angles in degrees about Y, then X, then Z ("rotate"); unset takes the level below.

std::optional<QcVec3> QcHoldTransform::scale

Metres per unit on each axis ("scale"); unset takes the level below.

std::optional<QcVec3> QcHoldTransform::translate

Offset in metres ("translate"); unset takes the level below.

Related Non-Members

enum class QcHoldCategory

What kind of thing is held; each kind has its defaults.

A definition picks its kind from what it is (the client's look of the item: block, launcher, tool, weapon) or names one in hold.category.

ConstantValueDescription
QcHoldTransform::QcHoldCategory::Tool0An item with a tool category or a fishing rod, data name "tool".
QcHoldTransform::QcHoldCategory::Weapon1Any other sprite item dealing more than 1 damage, data name "weapon".
QcHoldTransform::QcHoldCategory::Launcher2An item with a launcher (bow), data name "launcher".
QcHoldTransform::QcHoldCategory::Sprite3Any other flat item, data name "sprite".
QcHoldTransform::QcHoldCategory::Block4An item drawn as a full block, data name "block".
QcHoldTransform::QcHoldCategory::PartialBlock5An item drawn as a block of smaller boxes, data name "partialBlock".

enum class QcHoldGrip

Where a hand takes a sprite: by the end of its handle at the lower left (tools, weapons), in the middle (launchers) or from below (anything else).

Blocks are held by the middle of their boxes.

ConstantValueDescription
QcHoldTransform::QcHoldGrip::Base0From below, data name "base".
QcHoldTransform::QcHoldGrip::Handle1By the end of the handle at the lower left, data name "handle".
QcHoldTransform::QcHoldGrip::Middle2In the middle, data name "middle".

const std::size_t qcHoldCategoryCount

Number of values of QcHoldCategory.

const std::size_t qcHoldGripCount

Number of values of QcHoldGrip.