HandTriggerSkeleton

  • HandTriggerSkeleton is a script that is very similar to HandSkeleton, it generates callbacks and tracks triggers that are associated with a HandSkeleton

  • It requires a HandSkeleton component attached to the same object it is attached to

  • Like a HandSkeleton has its HandBones, HandTriggerSkeleton has a set of HandTriggerBones

  • HandTriggerBone is a specialized TriggerTracker that tracks active triggers that are associated with a HandBone and also sends out callbacks that are related to that triggers, not only to the behaviours derived from it, but also to the HandTriggerSkeleton it is added to

  • HandTriggerSkeleton's scripting API is completely equivalent to the HandSkeleton's API, all functions and properties of HandSkeleton that involve HandBones equivalently apply to the HandTriggerSkeleton with HandTriggerBone instead of HandBone, with some minor differences

  • One difference worth noting is that HandTriggerSkeleton does not require HandTriggerBone to be attached to the same object, like the HandSkeleton requires a HandBone attached to the same object the HandSkeleton is attached to that serves as its root bone (WristRoot), meaning the trigger skeleton can have zero bones attached to it

  • Another important note to take is that HandTriggerSkeleton can only have trigger bones that have the matching HandBone in the HandSkeleton that is associated with the trigger skeleton

  • For example if the HandSkeleton associated with the HandTriggerSkeleton does not have a HandBone that represents an IndexFingerDistalPhalanx bone then HandTriggerSkeleton cannot have a HandTriggerBone that would correspond to that same hand bone

  • HandTriggerSkeleton keeps its trigger bones in sync with the associated HandSkeleton, so if a HandBone is removed from the HandSkeleton, then HandTriggerBone that matches that HandBone is removed from the HandTriggerSkeleton as well; naturally, this occurs only if there is a matching HandTriggerBone in the trigger skeleton

  • The way you would build a HandTriggerSkeleton is the following:

    • Attach HandTriggerSkeleton to a GameObject that already has a HandSkeleton

    • Then you just add desired objects to serve as HandTriggerBones to the appropriate bone identities, but taking care of the fact that you cannot add trigger bone to it if the HandSkeleton associated with the trigger skeleton does not have a HandBone with the same identity added to it

  • HandTriggerBone script does not have to be attached to a GameObject prior to adding it to a HandTriggerSkeleton, it will be attached automatically when it gets added to the trigger skeleton or an existing one will be reused if the GameObject already has one that is not added to a HandTriggerSkeleton

  • Also of note is that the HandTriggerBone component can be attached to a GameObject multiple times, i.e. one GameObject can have multiple HandTriggerBones and they can all be added to different HandTriggerSkeletons

  • HandTriggerBone does not have any direct connection or a hard reference to a HandBone, the connection is only made indirectly via a HandTriggerSkeleton - what this means is that HandTriggerBone can be any GameObject, it does not have to be the same object that has a HandBone attached to match the trigger bone

  • Usually the GameObject that serves as HandTriggerBone should have a Collider attached that is set as trigger (Collider.isTrigger set to true), or it can have a Rigidbody/ArticulationBody component having trigger Collider in one or more of its child objects, as otherwise no trigger callbacks will be received by the HandTriggerBone, thus making the HandTriggerBone useless

  • Callbacks that are sent by HandTriggerSkeleton are exactly the same as the ones that are sent by TriggerTracker; they are implemented in the same way - as protected overrideable methods and have the same names as their TriggerTracker counterparts, with only one difference: they each have one additional method parameter of type HandBoneId which specifies the identity of the hand bone (trigger bone) that is the source of trigger callback

Last updated