Skip to main content

Climbable

A class in Root.Township, the global namespace.

Marks a surface players can climb. Hands add pressure each physics step, and the grip breaks if it goes over the maximum.

Constructors​

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

Fields​

9 private and internal fields
MemberWhat it is
private bool canMoveBacking field for CanMove.
private NetworkEntity entityBacking field for Entity. Must be on this object or a parent.
private float gripPriorityBacking field for GripPriority. Negative means ungrabbable.
private float lastTimeFixed time pressure was last applied. Used to reset the total each physics step.
private float maximumPressureBacking field for MaximumPressure. Above it the grip breaks; -1 means it never breaks.
private float oldPressureMagnitudeTotal pressure from the previous physics step.
private Rigidbody rigidbodyRigidbody this surface is on. If it is not kinematic, the surface can't be gripped.
private Vector3 totalPressurePressure added this physics step.
private float totalPressureMagnitudeMagnitude of totalPressure.

Properties​

MemberWhat it is
bool CanClimb { get; }Always true.
bool CanMove { get; }Whether the surface can move, set in the inspector.
Vector3 CurentPressure { get; }This step's total pressure, fading out soon after hands stop pushing.
float CurrentPressureRatio { get; }This step's pressure as a share of the maximum.
NetworkEntity Entity { get; }The network entity the climbable belongs to.
float GripPriority { get; protected set; }Priority over other grips the hand overlaps. -1 (ungrabbable) while its Rigidbody is non-kinematic.
float MaximumPressure { get; }Pressure that breaks the grip. -1 means it never breaks.
float OldPressureRatio { get; }Last step's pressure as a share of the maximum.
bool ReleasesImmediately { get; }Always false.
1 private and internal property
MemberWhat it is
private float FadeTime { get; }1 just after pressure was applied, fading to 0 over 0.2 seconds. Scales the current pressure values.

Events​

MemberWhat it is
event Action BreakRaised when pressure goes over MaximumPressure.

Methods​

MemberWhat it is
virtual bool ApplyPressure(Vector3 pressure)Adds a hand's pressure for this physics step. Raises Break and returns false if the total goes over the maximum.
virtual float GetGravityBoost(Vector3 normal)How much the surface helps against gravity for a contact normal. The normal's Y by default.

Used in​

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