Skip to main content

PlayerHeightFixer

A class in Root.Township, the global namespace.

Client: on the VR camera. Before each cull it raises or lowers the camera rig by the player's height setting plus any active platform offsets, clamped to a height range, and copies the result to another transform.

Constructors​

MemberWhat it is
PlayerHeightFixer()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

8 private and internal fields
MemberWhat it is
private Transform cachedTransformThis object's own transform (the tracked camera).
private Transform copyToTransform that gets the camera's local position plus the offset, and its rotation.
private Transform fixerParent transform that is moved up or down by the offset.
private static Logger loggerNLog logger for this class.
private float maxHeightHighest local camera height allowed after the offset (default 3).
private float minHeightLowest local camera height allowed after the offset (default 0.1).
private PlatformHeightOffsetSettings platformHeightOffsetsPer-platform offsets added when active.
private PlayerAdjustableHeightFixerSettings playerAdjustableHeightFixerSettingsSettings asset holding the player's chosen height adjustment.

Properties​

MemberWhat it is
static float ActualHeightFix { get; private set; }The vertical offset applied this frame. The OpenXR, SteamVR and player input code add it to tracked positions.

Methods​

3 private and internal methods
MemberWhat it is
private float GetPlatformHeightOffset()Adds up the offsets of every active entry in platformHeightOffsets. Warns and returns 0 if none are set.
private void OnPreCull()Unity camera callback: works out ActualHeightFix, clamps the camera height between minHeight and maxHeight, and moves fixer and copyTo.
private bool SetupFixer()Editor apply step that sets fixer to this object's parent.