Skip to main content

HandGrip.GripJoint

A class in Root.Township, Alta.Character.

One finger joint of a hand grip. It curls in steps until it touches a grabbed object, and blends between open, splayed, closed and saved poses.

Constructors​

MemberWhat it is
GripJoint()Creates a HandGrip.GripJoint from hand, joint, transform and rotations.
GripJoint(HandGrip hand, HandGripConfiguration.Finger.Joint joint, Transform transform, HandGripConfiguration.RotationSnapshots rotations)Creates a HandGrip.GripJoint from hand, joint, transform and rotations.

Fields​

MemberWhat it is
Matrix4x4 worldMatrixThe joint's world matrix, worked out while curling.
protected float curlProgressHow far the joint has curled, in degrees.
protected HandGrip handThe hand grip this joint belongs to.
protected HandGripConfiguration.Finger.Joint jointThe joint's configuration: length, radius, curl step and maximum curl.
protected Matrix4x4 localThe joint's default local matrix.
protected Matrix4x4 modifiedLocalThe local matrix after curling.
protected Transform transformThe joint's bone transform.
10 private and internal fields
MemberWhat it is
private Vector3 axisAxis the joint curls around, from the current thumb configuration.
private Quaternion closedRotationThe joint's rotation in the closed hand pose.
private Quaternion defaultRotationThe joint's local rotation when it was set up.
private bool isHitTrue when the last collision check found something. Gizmos draw red when set.
private int lastCurlMultiplierThe curl step the joint stopped at. This is what gets synced.
private int layerMaskLayer mask for the Active Tight Grip layer, used in the collision check.
private Quaternion openRotationThe joint's rotation in the open hand pose.
private Quaternion savedRotationThe rotation saved as the grip pose, blended towards when gripping.
private int sideMultiplier1 for the left hand and -1 for the right, so the joint box points the right way.
private Quaternion splaidRotationThe joint's rotation in the splayed hand pose.

Methods​

MemberWhat it is
bool CheckCollision()Checks whether the joint's box overlaps anything on the Active Tight Grip layer.
bool CurlIn(int curl, Matrix4x4 parent, bool isBaseMost)Curls the joint one more step if it can, then checks for contact. Returns whether it's touching.
void LerpToSave(float time, float skeleton, float splaid, bool isSkeletal, bool canGestureGripping)Blends the joint's rotation toward the saved grip pose, using the open and splayed poses when skeletal input is on.
void OnDrawGizmos(Matrix4x4 parent)Draws the joint's box, red when touching and green when not.
virtual void PrepareCurl()Resets the joint to its default pose before curling.
void Save()Stores the current curled rotation as the grip pose.
void SerializeGrip(Stream stream)Reads or writes how many curl steps the joint took, and rebuilds the pose when reading.

Used in​

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