Skip to main content

RelativePoint

A struct in Root.Township, the global namespace.

A position and rotation stored relative to a transform, so it follows that transform when it moves. With no transform it holds world values.

Constructors​

1 private and internal constructor
MemberWhat it is
private RelativePoint(Transform relativeTo, Vector3 localPosition, Quaternion localRotation)Creates a RelativePoint from relativeTo, localPosition and localRotation.

Fields​

3 private and internal fields
MemberWhat it is
private Vector3 localPositionBacking field for LocalPosition.
private Quaternion localRotationBacking field for LocalRotation.
private Transform relativeToBacking field for RelativeTo.

Properties​

MemberWhat it is
Vector3 LocalPosition { get; }Position in RelativeTo's space.
Quaternion LocalRotation { get; }Rotation in RelativeTo's space.
Transform RelativeTo { get; }The transform the point is relative to, or null for world space.
Vector3 WorldPosition { get; }The current world position, worked out from RelativeTo.
Quaternion WorldRotation { get; }The current world rotation, worked out from RelativeTo.

Methods​

MemberWhat it is
static RelativePoint FromLocal(Transform relativeTo, Vector3 localPosition, Quaternion localRotation)Makes a point from a local position and rotation on the given transform.
static RelativePoint FromTransform(Transform transform)Makes a point from a transform's local position and rotation under its parent.
static RelativePoint FromWorld(Transform relativeTo, Vector3 worldPosition, Quaternion worldRotation)Makes a point from a world position and rotation, converted into the given transform's space.

Used in​

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