Skip to main content

RigidbodyGroup

A class in Root.Township, the global namespace.

Group of rigidbodies on a player character that can be set kinematic, moved or given a velocity together. When the player teleports, it sets their velocity to the teleport offset.

Constructors​

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

Fields​

5 private and internal fields
MemberWhat it is
private bool isKinematicLast kinematic value set.
private Vector3 localPositionLast local position set.
private PlayerCharacter playerBacking field for Player.
private Vector3 velocityLast velocity set.
private float velocityMultiplierSerialized multiplier; not used in this code.

Properties​

MemberWhat it is
bool IsKinematic { set; }Sets every rigidbody kinematic or not.
Vector3 LocalPosition { set; }Sets every rigidbody's local position.
Vector3 Velocity { set; }Sets every rigidbody's velocity.
1 private and internal property
MemberWhat it is
private PlayerCharacter Player { get; }Player character on this object, fetched on first use.

Methods​

3 private and internal methods
MemberWhat it is
private void OnDisable()Stops listening for player teleports.
private void OnEnable()Listens for the player's locomotion position changes.
private void PlayerAboutToTeleport(PlayerController player, Vector3 oldPosition, Vector3 newPosition, LocomotionFunction function)Sets every rigidbody's velocity to the teleport offset.