Skip to main content

TimberPiece.RotationModel

A class in Root.Township, Alta.Carpentry.

Works out how a TimberPiece tips over as it is chiselled: the axis it rotates around and how far the pivot edge is from its centre.

Constructors​

MemberWhat it is
RotationModel(Vector3 pivottingDirection, Vector3 size, bool inversedUp)Creates a TimberPiece.RotationModel from pivottingDirection, size and inversedUp.

Fields​

4 private and internal fields
MemberWhat it is
private bool inversedUpWhen true, the rotation axis is reversed (the piece is upside down).
private Vector3 pivottingDirectionThe direction the piece pivots towards.
private Vector3 sizeThe piece's size, used to find the edge distance.
private float xCompareNormalised X of the size. Decides whether the X or Z half-size is used for Distance.

Properties​

MemberWhat it is
float Distance { get; private set; }Distance from the piece's centre to its edge along the pivot direction, from the piece size.
bool IsValid { get; private set; }False when built with a zero pivot direction. Update sets it to true.
Vector3 RotationAxis { get; private set; }Horizontal axis at right angles to the pivot direction, flipped when inversedUp is set.

Methods​

MemberWhat it is
void Update(Vector3 newDirection)Recalculates Distance and RotationAxis for a new pivot direction.

Used in​

Members of other types that take, return or hold a RotationModel: