Skip to main content

CopyBone

A class in Root.Township, the global namespace.

Makes this object follow a Bone's local pose, by joint target, by moving its rigidbody, or by setting the transform.

Constructors​

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

Fields​

14 private and internal fields
MemberWhat it is
private List<Bone> autoFindBones list, probably for an editor auto-assign. Not read here.
private Bone boneBone to copy.
private Transform boneTransformTransform of bone.
private Transform cachedTransformThis object's transform.
private bool isJointedTrue when a ConfigurableJoint was found.
private bool isPreviewingPoseSerialized but not read here.
private bool isRigidbodyTrue when this object has a rigidbody.
private bool isTransformForcedAlways copy the transform directly even with a rigidbody.
private ConfigurableJoint jointThe configurable joint on this object.
private Quaternion jointToWorldInverse of worldToJoint.
private float maximumTorqueSerialized but not read here.
private Rigidbody topicThe rigidbody on this object.
private float torqueMultiplierSerialized but not read here.
private Quaternion worldToJointRotation into the joint's space.

Methods​

4 private and internal methods
MemberWhat it is
private void Awake()Destroys itself with no bone. Finds a rigidbody and joint, links the joint to the parent's body, and caches joint space.
private void FixedUpdate()When the bone moved, drives the joint target, moves the rigidbody, or copies the local transform.
private void OnDisable()Resets local rotation.
private void OnEnable()Snaps local position and rotation to the bone.