top of page

VR Hand Animation Instance

VR hand animation instance class which can be used as parent class of animation blueprint.

Class name:

Include:

Type:

Lines of code:

UVR_HandAnimationInstance

#include "VR/VR_Player/VR_HandAnimationInstance.h"

Animation Instance

479

​General Information

Description

VR Hand Animation Instance class is a child of the animation instance class. Animation blueprints can be inherited from it. This class must be used for VR Hand animation and should be applied to FakeHandMesh and RealHandMesh components in VR Hand inherited blueprint(Otherwise it will crash)(See VR Hand Class).



Variables
  • FFingerCurls CurrentFingerCurls - Current curls of each finger from the motion controller.

  • FFingerCurls FingerCurls - Curls of each finger with smooth transition.

  • float GripThumb, GripIndex, GripMiddle, GripRing, GripPinky - Grip values for IK(Values from 0 to 1).

  • float IndexPushInst - Trigger button push value(from 0 to 1).

  • float HammerPushInst - Thumb button push value(from 0 to 1). This parameter can be used in pistols/revolvers to pull the hammer.

  • float HandOrientationZ - This is a varialble which contains a orientation value(from 0 to 1). If hand faces X,Y or Z direction value will be 1.

  • FVector OriginThumb, OriginIndex, OriginMiddle, OriginRing, OriginPinky - These are varialbles which contain origin locations for location based IK(Optional IK Method).

  • FVector TargetThumb, TargetIndex, TargetMiddle, TargetRing, TargetPinky - These are varialbles which contain taget locations for location based IK(Optional IK Method).

  • bool ProceduralSkeletonEnabled  - This is a variable which contains whether or not  procedural skeleton is enabled(Outdated and will be removed in the future).

  • bool bHasWeapon - This is a variable which indicates whether or not hand has a weapon.

  • bool bA_Pressed - This is a variable which indicates whether or not A button was pressed on the controller.

  • bool bB_Pressed  - This is a variable which indicates whether or not B button was pressed on the controller.

  • bool bTrackpad_Touch - This is a variable which indicates whether or not Traskpad was touched on the controller.

  • bool bWantsToGrab - This is a variable which indicates whether or not hand wants to grab something.

  • EAnimationType AnimType - This is a variable which indicates hand animation type(See VR Variables).

  • EPickUpAnimations PickUpAnimation - This is a variable which indicates hand grab animation(See VR Variables).

  • bool bIsGrabbed - This is a variable which indicates whether or not hand is grabbing the object.

  • UAnimSequence * GrabAnimation - This is a variable which contains a grab animation from grabbed object.

  • UAnimSequence* TriggerPressedAnimation - This is a variable which contains a trigger pressed animation from grabbed object.

  • UAnimSequence* APressedAnimation - This is a variable which contains a A pressed animation from grabbed object. 

  • UAnimSequence* BPressedAnimation - This is a variable which contains a B pressed animation from grabbed object. 

  • EControllerHand Hand - This is a variable which indicates hand.

  • EGrip_Code CurrentGripState - This is a variable which indicates hand grip state.


Animation Blueprint Example

Algorithm overview

Examaple hand animation blueprint contains State machine, Base animation section, Animation based IK section, Idle Pose section and Position Base IK(Optional IK Method).



Base Animations

Base Animations contains 3 cached poses(Open, Stratched and Cloused). They are used in other sections.


Idle Pose

Idle Pose section blends hand orientation(HandOrientationZ) with stratched pose. Then output blends with closed hand cache by finger curls(Make sure there are right bone names according to the skeleton).


Animation Based IK

Animation Based IK contains blend per bone for each finger(Make sure there are right bone names according to the skeleton). Blend uses Grip variables (GripThumb, GripIndex, GripMiddle, GripRing, GripPinky). Output goes to the cached pose.


Position Based IK (Optional)

Animation Based IK contains two bone IK nodes(Make sure there are right bone names according to the skeleton) for each finger.

State machine

State machine contains 3 states: Idle, Grip IK and Animation Grip.



Idle state

Idle state contains blends if player wants to grip. If player press the grip button and move the hand close to the object it will predict the pose(Rotate fingers a bit).


Grip IK

Grip IK contains Animation Based IK cache.


Animation Grip

Animation Grip has animation state machine in which are two conditions: Prop Unique and Weapon or Equipment. In the Prop Unique this an animation variable. In the Weapon or Equipment there are blends and animation variables for Grab, Trigger button press, A/B button press etc.


Blueprint API Reference

Public Member Functions

 

void 	SetGripState (EGrip_Code GripState)
 
 

bool 	SetSkeletalState (EControllerHand EHand)
 
 

void 	SetEAnimationType (EAnimationType NewAnimType)
 
 

void 	SetGripThumb (float NewGrip)
 
 

void 	SetGripIndex (float NewGrip)
 
 

void 	SetGripMiddle (float NewGrip)
 
 

void 	SetGripRing (float NewGrip)
 
 

void 	SetGripPinky (float NewGrip)
 
 

void 	SetHandType (EControllerHand Hand)
 
 

void 	SetHasWeapon (bool HasWeapon)
 
 

void 	Set_IsGrabbed (bool IsGrabbed)
 
 

void 	SetA_Pressed (bool Pressed)
 
 

void 	SetIndexPushInst (float Inst)
 
 

void 	SetW_HammerInst (float Inst)
 
 

void 	SetTrackpad_Touch (bool Touched)
 
 

void 	SetFingerCurls (FFingerCurls NewFingerCurls)
 
 

bool 	GetTrackpad_Touch ()
 
 

float 	GetIndexPushInst ()
 
 

float 	GetGripThumb ()
 
 

float 	GetGripIndex ()
 
 

float 	GetGripMiddle ()
 
 

float 	GetGripRing ()
 
 

float 	GetGripPinky ()
 
 

bool 	GetProceduralSkeletonEnabled ()
 
 

bool 	GetHasWeapon ()
 
 

bool 	GetA_Pressed ()
 
 

bool 	Get_IsGrabbed ()
 
 

float 	GetW_HammerInst ()
 
 

FORCEINLINE FFingerCurls 	GetFingerCurls () const
 
 

FORCEINLINE EControllerHand 	GetHandType () const
 
 

EPickUpAnimations 	GetPickUpAnimation ()

 

Protected Attributes

 

FFingerCurls 	CurrentFingerCurls
 
 

FFingerCurls 	FingerCurls
 
 

float 	GripThumb
 
 

float 	GripIndex
 
 

float 	GripMiddle
 
 

float 	GripRing
 
 

float 	GripPinky
 
 

float 	IndexPushInst
 
 

float 	HammerPushInst
 
 

float 	HandOrientationZ
 
 

FVector 	OriginThumb
 
 

FVector 	OriginIndex
 
 

FVector 	OriginMiddle
 
 

FVector 	OriginRing
 
 

FVector 	OriginPinky
 
 

FVector 	TargetThumb
 
 

FVector 	TargetIndex
 
 

FVector 	TargetMiddle
 
 

FVector 	TargetRing
 
 

FVector 	TargetPinky
 
 

bool 	ProceduralSkeletonEnabled
 
 

bool 	bHasWeapon
 
 

bool 	bA_Pressed
 
 

bool 	bB_Pressed
 
 

bool 	bTrackpad_Touch
 
 

bool 	bWantsToGrab
 
 

EAnimationType 	AnimType
 
 

EPickUpAnimations 	PickUpAnimation
 
 

bool 	bIsGrabbed
 
 

UAnimSequence * 	GrabAnimation
 
 

UAnimSequence * 	TriggerPressedAnimation
 
 

UAnimSequence * 	APressedAnimation
 
 

UAnimSequence * 	BPressedAnimation
 
 

EControllerHand 	Hand
 
 

EGrip_Code 	CurrentGripState
 

bottom of page