Humanoid Control for Unity v4
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Properties | List of all members
Passer.Humanoid.HandTarget Class Reference

Description

Humanoid Control options for hand-related things

Sensors

See the list of supported devices to get information on the hand target of each device.

Sub Targets

Thumb and Finger Curl

The current curl value of the thumb and/or fingers is found here. It is possible to control the curl value of a finger of thumb directly using the slider during play if it is not directly controlled by input or hand poses. If it is controlled by input, the current curl value can be seen here.

Configuration

Bones

For Mecanim compatible avatars, the correct bones are detected automatically. For other avatars, the correct bone Transforms can be assigned manually using the Bone parameters. It is also possible to override the default bones from Mecanim with your own choice by manual assignment of the bone. To return to the default bone, it is sufficient to clear the applicable Bone parameter. For the thumb and finger bones, only the first, proximal bone is needed, other child bones will be detected automatically.

Limits

For the arm bones, it is possible to configure the limits of movement. The maximum angle can be set when Joint Limitations is enabled.

Hand Pose

Shows the currently detected hand pose. More information on hand poses can be found here.

Settings

Events

Buttons

Inheritance diagram for Passer.Humanoid.HandTarget:
Passer.Humanoid.HumanoidTarget Passer.Target

Public Types

enum  GrabType { HandGrab , Pinch }
 
enum  PoseMethod { Position , Rotation }
 
enum  GrabbingTechnique { TouchGrabbing , NearGrabbing , NoGrabbing }
 Grabbing techniques. More...
 

Public Member Functions

virtual void StartInteraction ()
 
virtual HandSocket CreateGrabSocket ()
 
Socket CreatePinchSocket ()
 
void OnNearing (GameObject obj)
 
virtual void OnTouchStart (GameObject obj, Vector3 contactPoint)
 
virtual void OnTouchEnd (GameObject obj)
 
void GrabTouchedObject ()
 Try to grab the object we touch.
 
void NearGrabCheck ()
 Check the hand for grabbing near objects.
 
void GrabNearObject ()
 Try to grab an object near to the hand.
 
void GrabCheck (GameObject obj)
 Try to take the object.
 
virtual bool CanBeGrabbed (GameObject obj)
 
virtual void Grab (GameObject obj, bool rangeCheck=true)
 Grab and object with the hand (non-networked)
 
void GrabHandle (Handle handle, bool rangeCheck=false)
 
virtual void LetGo ()
 
void GrabOrLetGo (GameObject obj, bool rangeCheck=true)
 
override Transform GetDefaultTarget (HumanoidControl humanoid)
 
Bone GetBoneId (bool isLeft, ArmBones armBone)
 
TargetedBone GetTargetBone (ArmBones boneID)
 
void RetrieveBones ()
 
void SetPose1 (Pose pose)
 
void SetPose (Pose pose, float weight)
 
bool TouchedStaticObject ()
 
bool GrabbedStaticObject ()
 
Vector3 HandBoneRightAxis ()
 
Vector3 HandBoneOutwardAxis ()
 
void InitTarget ()
 
override void InitAvatar ()
 
override void NewComponent (HumanoidControl _humanoid)
 
override void InitComponent ()
 
override void StartTarget ()
 
override void MatchTargetsToAvatar ()
 
void CopyBoneToTarget (ArmBones armBone, TargetedBone bone)
 
override void InitializeTrackingConfidence ()
 
override void UpdateTarget ()
 
void SetTargets ()
 
override void UpdateMovements (HumanoidControl humanoid)
 
override void CopyTargetToRig ()
 
override void CopyRigToTarget ()
 
void UpdateSensorsFromTarget ()
 
float GetFingerCurl (Finger fingerID)
 
float GetFingerCurl (FingersTarget.TargetedFinger finger)
 
void AddFingerCurl (Finger fingerID, float curlValue)
 
void SetFingerCurl (Finger fingerID, float curlValue)
 
void SetFingerGroupCurl (FingersTarget.FingerGroup fingerGroupID, float curlValue)
 
void DetermineFingerCurl (Finger fingerID)
 
float HandCurl ()
 
void Vibrate (float strength)
 
void OnDrawGizmos ()
 
void OnDrawGizmosSelected ()
 
virtual void DrawTensions ()
 
void InitSensors ()
 
virtual void StartSensors ()
 
virtual void StopSensors ()
 

Static Public Member Functions

static HandTarget CreateTarget (HandTarget oldTarget)
 
static HandTarget SetTarget (HumanoidControl humanoid, Transform targetTransform, bool isLeft)
 
static void ClearBones (HandTarget handTarget)
 
static void TmpDisableCollisions (HandTarget handTarget, float duration)
 
static bool IsInitialized (HumanoidControl humanoid)
 
static void DetermineTarget (HumanoidControl humanoid, bool isLeft)
 Checks whether the humanoid has an HandTarget and adds one if none has been found.
 
static Vector ToVector (Vector3 vector3)
 
static Vector3 ToVector3 (Vector position)
 
static Rotation ToRotation (Quaternion quaternion)
 
static Quaternion ToQuaternion (Rotation orientation)
 
static void SetRotation (Transform transform, Rotation orientation)
 
static void DrawTarget (Confidence confidence, Transform target, Vector3 direction, float length)
 
static void DrawTargetBone (TargetedBone bone, Vector3 direction)
 
static void DrawTargetBone (TargetTransform target, Vector3 direction)
 
static void DrawAvatarBone (TargetedBone bone, Vector3 direction)
 
static void DrawAvatarBone (BoneTransform bone, Vector3 direction)
 
static void GetDefaultBone (Animator rig, ref Transform boneTransform, Bone boneId, params string[] boneNames)
 
static void GetDefaultBone (Animator rig, ref Transform boneTransform, HumanBodyBones boneID, params string[] boneNames)
 
static void GetDefaultBone (Animator rig, ref Transform boneTransform, params string[] boneNames)
 
static void GetDefaultTargetBone (Animator rig, ref Transform boneTransform, Bone boneID, params string[] boneNames)
 
static List< Collider > SetColliderToTrigger (GameObject obj)
 
static List< Collider > SetColliderToTrigger (Rigidbody rb)
 
static void UnsetColliderToTrigger (List< Collider > colliders)
 
static void UnsetColliderToTrigger (List< Collider > colliders, Collider collider)
 

Public Attributes

bool isLeft
 Is this the left hand?
 
Side side
 Left or right hand side hand.
 
Vector3 outward
 Vector pointing toward the outward direction of the hand. In general this is the index finger pointing direction.
 
Vector3 up
 Vector3 pointing toward the up direction of the hand. This is the opposite side of the palm of the hand.
 
FingersTarget fingers = null
 
bool rotationSpeedLimitation = false
 Limits the maximum rotation speed of the joints. This can result in more natural movements with optical tracking solutions.
 
UnityXRController unity
 
ArmAnimator armAnimator = new ArmAnimator()
 
UnityXRHand unityXR = new UnityXRHand()
 
ViveTrackerArm viveTracker = new ViveTrackerArm()
 
WindowsMRHand mixedReality = new WindowsMRHand()
 
WaveVRHand waveVR = new WaveVRHand()
 
LeapHand leap = new LeapHand()
 
Kinect1Arm kinect1 = new Kinect1Arm()
 
Kinect2Arm kinect2 = new Kinect2Arm()
 
Kinect4Arm kinect4 = new Kinect4Arm()
 
AstraArm astra = new AstraArm()
 
RazerHydraHand hydra = new RazerHydraHand()
 
OptitrackArm optitrack = new OptitrackArm()
 
AntilatencyHand antilatency = new AntilatencyHand()
 
Hi5Hand hi5 = new Hi5Hand()
 
CustomArm custom = new CustomArm()
 
Transform stretchlessTarget
 
TargetedShoulderBone shoulder
 
TargetedUpperArmBone upperArm
 
TargetedForearmBone forearm
 
TargetedHandBone hand
 
PoseMethod poseMethod
 
bool physics = true
 Enables physics for this hand.
 
AdvancedHandPhysics.PhysicsMode physicsMode = AdvancedHandPhysics.PhysicsMode.HybridKinematic
 
float strength = 100
 The strength of the arm when interacting with physics.
 
GrabbingTechnique grabbingTechnique = GrabbingTechnique.TouchGrabbing
 The GrabbingType used to grab objects.
 
bool touchInteraction = true
 Enables touch interaction with the envrionment.
 
Pose detectedPose
 
PoseMixer poseMixer = new PoseMixer()
 
HandSocket grabSocket
 The Socket for holding objects with the whole hand.
 
Socket pinchSocket
 The Socket for holding objects between the thumb and index finger.
 
InteractionModule inputModule
 
GameObject touchedObject = null
 
GameObject grabbedPrefab
 
GameObject grabbedObject
 
Handle grabbedHandle = null
 
Vector3 targetToHandle
 
bool grabbedRigidbody
 
bool grabbedKinematicRigidbody
 
List< Collider > colliders
 
bool twoHandedGrab = false
 
Vector3 targetToSecondaryHandle
 
IntEventHandlers poseEvent
 Use to call functions based on the defined poses of the hand.
 
GameObjectEventHandlers touchEvent
 Use to call functions based on the hand touching objects.
 
GameObjectEventHandlers grabEvent
 Use to call functions based on the hand grabbing objects.
 
Transform handPalm
 
Rigidbody handRigidbody
 
AdvancedHandPhysics handPhysics
 
HandMovements handMovements = new HandMovements()
 
ArmMovements armMovements = new ArmMovements()
 
bool grabbedChanged
 
bool directFingerMovements = true
 
HumanoidControl humanoid
 

Static Public Attributes

static float maxGrabbingMass = 10
 The maximum mass of object you can grab.
 
const float maxShoulderAngle = 30
 
const float maxUpperArmAngle = 120
 
const float maxForearmAngle = 130
 
const float maxHandAngle = 100
 
static readonly Vector3 minLeftShoulderAngles = new Vector3(0, 0, -45)
 
static readonly Vector3 maxLeftShoulderAngles = new Vector3(0, 45, 0)
 
static readonly Vector3 minRightShoulderAngles = new Vector3(0, -45, 0)
 
static readonly Vector3 maxRightShoulderAngles = new Vector3(0, 0, 45)
 
static readonly Vector3 minLeftUpperArmAngles = new Vector3(-180, -45, -180)
 
static readonly Vector3 maxLeftUpperArmAngles = new Vector3(60, 130, 45)
 
static readonly Vector3 minRightUpperArmAngles = new Vector3(-180, -130, -45)
 
static readonly Vector3 maxRightUpperArmAngles = new Vector3(60, 45, 180)
 
static readonly Vector3 minLeftForearmAngles = new Vector3(0, 0, 0)
 
static readonly Vector3 maxLeftForearmAngles = new Vector3(0, 150, 0)
 
static readonly Vector3 minRightForearmAngles = new Vector3(0, -150, 0)
 
static readonly Vector3 maxRightForearmAngles = new Vector3(0, 0, 0)
 
static readonly Vector3 minLeftHandAngles = new Vector3(-180, -50, -70)
 
static readonly Vector3 maxLeftHandAngles = new Vector3(90, 20, 90)
 
static readonly Vector3 minRightHandAngles = new Vector3(-90, -20, -70)
 
static readonly Vector3 maxRightHandAngles = new Vector3(45, 50, 70)
 

Protected Member Functions

void MoveToPalm (Transform t)
 
void DeterminePalmPosition ()
 
void LerpToGrab (GameObject obj)
 
virtual GameObject DetermineGrabObject ()
 
bool GrabbedWithOtherHand (GameObject obj)
 
bool SecondHandGrab (GameObject obj, bool rangeCheck)
 
virtual bool GrabHandle (Rigidbody objRigidbody, Handle handle, bool rangeCheck)
 
virtual bool GrabRigidbody (Rigidbody objRigidbody, bool rangeCheck=true)
 
virtual bool GrabRigidbodyHandle (Rigidbody objRigidbody, Handle handle, bool rangeCheck)
 
virtual bool GrabRigidbodyWithoutHandle (Rigidbody objRigidbody)
 
virtual bool GrabRigidbodyParenting (Rigidbody objRigidbody)
 
virtual bool GrabStaticWithoutHandle (GameObject obj)
 
virtual void CheckLetGo ()
 
virtual bool PulledLoose ()
 summary>Let go the object the hand is holding (if any)
 
virtual void LetGoRigidbodyWithoutHandle ()
 
virtual void LetGoStaticWithoutHandle ()
 
virtual void LetGoRigidbody (Rigidbody grabbedRigidbody)
 
virtual void LetGoHandle (Handle handle)
 
void LetGoPinch ()
 
void InitSubTargets ()
 
virtual void UpdateEvents ()
 
void CheckRigidbody ()
 
void UpdateUsingTrackedRigidbody (TrackedRigidbody trackedRigidbody)
 
void UpdateTwoHanded2 ()
 
Vector3 Orthagonal (Transform primaryTransform, Transform secondaryTransform)
 
override void DrawTargetRig (HumanoidControl humanoid)
 
override void DrawAvatarRig (HumanoidControl humanoid)
 
void CheckColliders ()
 
virtual void GenerateColliders ()
 
virtual void DrawTensionGizmo (TargetedBone targetedBone)
 
virtual void UpdateSensors ()
 

Static Protected Member Functions

static void DebugLog (string s)
 

Protected Attributes

bool grabChecking = false
 
bool letGoChecking = false
 
float letGoCheckStart
 
ArmSensor[] sensors
 
List< SensorComponentsensorComponents = new List<SensorComponent>()
 
List< TrackedRigidbody > trackedRigidbodies = new List<TrackedRigidbody>()
 
bool _showRealObjects = true
 

Properties

override Passer.Sensor animator [get]
 
bool isTrackingHand [get, protected set]
 Is this hand currently using hand tracking?
 
override TargetedBone main [get]
 
int detectedPoseIx [get, protected set]
 
HandTarget otherHand [get]
 
Vector3 localPalmPosition [get]
 
Vector3 palmPosition [get]
 
Quaternion palmRotation [get]
 
virtual bool showRealObjects [get, set]
 show the target meshes
 

Member Enumeration Documentation

◆ GrabbingTechnique

Grabbing techniques.

Enumerator
TouchGrabbing 

try to grab the object when you touch it and you close the hand

NearGrabbing 

try to grab an object near to your hand when you close the hand

NoGrabbing 

do not try to grab objects when you close the hand

Member Function Documentation

◆ NearGrabCheck()

void Passer.Humanoid.HandTarget.NearGrabCheck ( )

Check the hand for grabbing near objects.

This function will grab a near object if the hand is grabbing

◆ GrabCheck()

void Passer.Humanoid.HandTarget.GrabCheck ( GameObject  obj)

Try to take the object.

Parameters
objThe object to take

Depending on the hand pose the object may be grabbed, pinched or not

◆ Grab()

virtual void Passer.Humanoid.HandTarget.Grab ( GameObject  obj,
bool  rangeCheck = true 
)
virtual

Grab and object with the hand (non-networked)

Parameters
handTargetThe hand to grab with
objThe gameObject to grab
rangeCheckcheck wither the hand is in range of the handle

◆ NewComponent()

override void Passer.Humanoid.HandTarget.NewComponent ( HumanoidControl  _humanoid)
virtual

Reimplemented from Passer.Humanoid.HumanoidTarget.

◆ InitComponent()

override void Passer.Humanoid.HandTarget.InitComponent ( )
virtual

Reimplemented from Passer.Target.

◆ DetermineTarget()

static void Passer.Humanoid.HandTarget.DetermineTarget ( HumanoidControl  humanoid,
bool  isLeft 
)
static

Checks whether the humanoid has an HandTarget and adds one if none has been found.

Parameters
humanoidThe humanoid to check
isLeftIs this the left hand?

◆ DrawTargetRig()

override void Passer.Humanoid.HandTarget.DrawTargetRig ( HumanoidControl  humanoid)
protectedvirtual

Reimplemented from Passer.Humanoid.HumanoidTarget.

◆ DrawAvatarRig()

override void Passer.Humanoid.HandTarget.DrawAvatarRig ( HumanoidControl  humanoid)
protectedvirtual

Reimplemented from Passer.Humanoid.HumanoidTarget.

Member Data Documentation

◆ physics

bool Passer.Humanoid.HandTarget.physics = true

Enables physics for this hand.

See Physics.

◆ touchInteraction

bool Passer.Humanoid.HandTarget.touchInteraction = true

Enables touch interaction with the envrionment.

See Interaction

◆ poseEvent

IntEventHandlers Passer.Humanoid.HandTarget.poseEvent
Initial value:
= new IntEventHandlers() {
id = 1,
label = "Pose Event",
tooltip =
"Call functions based on recognized poses" +
"Parameter: the index of the recognized pose",
eventTypeLabels = new string[] {
"Never",
"On Pose Recognized",
"On No Pose Recongnized",
"While Pose Recognized",
"While No Pose Recognized",
"When Pose Changes",
"Always",
},
fromEventLabel = "poseMixer.detectedPoseIx",
}

Use to call functions based on the defined poses of the hand.

◆ touchEvent

GameObjectEventHandlers Passer.Humanoid.HandTarget.touchEvent
Initial value:
= new GameObjectEventHandlers() {
id = 2,
label = "Touch Event",
tooltip =
"Call funtions based on touched objects" +
"Parameter: the touched object",
eventTypeLabels = new string[] {
"Never",
"On Touch Start",
"On Touch End",
"While Touching",
"While not Touching",
"On Touched Object Changes",
"Always",
},
fromEventLabel = "touchedObject",
}

Use to call functions based on the hand touching objects.

◆ grabEvent

GameObjectEventHandlers Passer.Humanoid.HandTarget.grabEvent
Initial value:
= new GameObjectEventHandlers() {
id = 3,
label = "Grab Event",
tooltip =
"Call functions based on grabbed objects" +
"Parameter: the grabbed object",
eventTypeLabels = new string[] {
"Never",
"On Grab Start",
"On Grab End",
"While Holding Object",
"While not Holding Object",
"On Grabbed Object Changes",
"Always",
},
fromEventLabel = "grabbedObject",
}

Use to call functions based on the hand grabbing objects.


The documentation for this class was generated from the following files: