Purpose: let fingers facilitate on different grap
Go to VR Pawn, viewport,
turn off HMD and R hand visible mesh
To create curve for each finger targets to follow:
Thumb:
Add component “Spline” under MotionControllerLeft , rename as L_ThumbArc
Move the cursor away from the hand
R click on the line from cursor, Add spline point here
Set the location values from each spline point as follow:
*Remark: select either 1st, last, or next/previous spline point on here:
Last spline (input key 2.0)
First spline (input key 0)
middle spline (input key 1.0)
Repeat the same for remained 4 fingers by duplicating L_ThumbArc, rename as L_IndexArc...
On IndexArc, drag cursor away from ThumbArc cursor, Add another spline point (i.e. 1 more spline point (4 points) than thumbarc)
First spline value:
Last spline:
Last second spline:
Second Spline:
Duplicate L_IndexArc, rename as L_MiddleArc:
Duplicate MiddleArc, rename as L_ringArc:
Duplicate RingArc, rename as PinkyArc
Drag all Arc splines under the lefthand mesh
Place each arc transform values as below to let the spline snap on correct position on the hand mesh:
Middle Arc:
Thumb Arc
Index
Ring
Pinky
Copy all 5 arc from lefthand mesh, turn lefthand mesh invisible and righhand visible,
then paste in righthand mesh
Rename all Arc from L to R
Tip: if the pasted arc not snap on righthand mesh on correct transform position, use this trick:
1) Copy all the Arcs just like he said in the tutorial (using ctrl+c)
2) move 1 Arc (Shouldn't matter which one) from the left hand to the right hand (it has to be attached there, so if you click on the little triangle next to "RightHand" it should disappear in the components window - click the triangle again now to make it appear again)
3) In the components window, click on the Arc you just attached to the right hand
4) now Paste all the Arcs you copied before (using ctrl+v) with the Arc selected - they should now flip into the right position
5) move the arc you "stole" from the left hand back to the left hand, so that it is attached there, DONE
Programming procedural grip functionality:
Create a variable, type choose Primitive Compenent → Object Reference
Rename as R_PrimitiveComponent
Duplicate this component, rename as L_PrimitiveComponent
Open Grab Component Event graph,
In Cast to VR Pawn node, drag out to promote variable, rename as VR Pawn
Drag it to the end to connect to Right Hand Amin
To let user grab any object that can make procedural hand code works:
Go to Try Grab function, at Orient the held actor to match grabcomponent’s relative location column
Set World location node, add those nodes:
Drag SET node from Free function to Switch on EControllerHand just created:
Create Right hand anim as follow to connect to Econtrollerhand:
Duplicate the new 6 nodes made,
replace:
Right hand anim to left,
object type to Basic left,
and Set Primitive Component to L
Connect to Left on EControllerhand:
Now whenever user picks up an object, it will set that object as the left primitive component inside VR pawn
To Try Release funtion graph (to unset the object, or else if pick up new objects, won’t be conform again):
At the end of the nodes, add below:
Create Struct variable (for setup new variables for finger animation system) :
In VR template → Blueprint, R click, structure
Rename as Finger_Data, open it
Change to Float, add 4 variable, name as below:
Go to VR Pawn ,add variable, change type to finger Data and name as R FingerData:
Click compile, should see R Finger Data in Details, and rename Category to ProceduralFingers Duplicate R_FingerData variable, rename as L_FingerData
Add a new variable, name as R_FingerCacheThumb, type as array ,vector, Category to proceduralfinger
Duplicate 4 times and change from thumb to follow:
Duplicate all 5 again and change from R to L
Add 1 more vairable, set as follow and name as FingerSteps, steps set as 4 after hit complie:
Click + icon at Functions to create a new function, name as Get Finger Steps
Scroll to bottom in My blueprint tab, add the follow 2 local variables:
Click on the Get Finger Steps node, add Input, change to Spline Component, Object Reference
rename as Finger Spline
Connect to SET step size, and drag FingerSteps integer in graph, type“To float”, connect it, and final as follow:
Click on Get Finger Steps node again, add output, change as follow:
Add nodes as below:
Finally add temp cache, add node, and connect back to Loop node:
Go back to Event Graph, add another new function, name as Trace Finger Segment:
Add the following local variables:
Click on the trace finger segment node, add inputs and output as follow:
Set the graph as below:
Get point Array, type get a ref (will become a GET node)
Continue to add nodes as follow:
Continue from SET TempB as follow:
From the Sequence Then 1 output, add as follow:
Now, 2 main functions are made for getting the finger animation data
Create a main functionality for finger animation:
In VR Pawn event graph, add new graph, name as Finger Animation Graph, open it
In the blank graph, type “add custom Event”, name as Setup Finger Anim Data:
Add 2 sequence (hotkey, S+L click), add pins till 9 on 2nd sequence
For destroy component below, just choose any arc and then delete the arc node
Drag all 10 Arc from components (duplicate them on 2nd sequence, arrange them from thumb to pinky):
Drag SET R Finger Cache Thumb variable, connect with get finger steps node and R thumb Arc
Duplicate and repeat, except replace with correct arc, and correct Finger Cache
Still in the same graph, add 2 new custom events:
Drag following Component to the graph, and add nodes as such, split stucture pin on SET R FingerData :
Add all 5 R_fingerCache variables and Righthand (from Components), and finish the graph as below:
Copy the whole nodes above, apply on L_TraceFingerData, replace all nodes from right to left hand:
Set up the to call finger anim data and trace finger data:
Go to VR Pawn Event Graph, insert Setup finger amin data node after event beginplay
Go to Grab Component BP, Try Grab function, add the following 2 nodes at SET Primitive Components:
Set final animation code at BP hand to make procedural grip code work:
Open BP_HandAnim, event graph, start on left Grib anim node (not L Thumb Anim,, mistake by video), drag object type variable, add equal eumin node (type ==), set basic left
In Objecthold eumin, add branch and connect back to AND node
Add new variable, name as L_FingerData, change its type to Finger Data, comply
drag it in graph, and add LFingerdata node, connect to Cast to VRPwan
repeat the same on R hand, set equal eumin node as basic instead of basic left, duplicate L fingerdata variable and name as R
Go to AnimGraph → HandAnimations → Object (State)
drag in obejct type variable, type as follow for blendposes Enume node:
R click on the blend poses node, add Basic and basic left
Final nodes graph like this:
create Procedural hand system by using finger float data created in VR pawn:
Back to AnimGragh, create 2 cache poses (for referencing multiple times without have to pullout of asset browsers)
Drag Anim QK grip and Anim QK stretched from Asset Browser from bottom R corner, type follow for savepose32051 node:
Rename the savednode as ProceduralGrab
Add another cahced poses on QK stretched, also rename as StretchPose
Back to Object (State), add 2 Use cached pose nodes
Add layered blend node on strechpose:
Add Blend pin 3 times by R click on layerd blend per bone node, layers setup have 5 indexs in Details column
Click Add element index 0 → unfold members, rename Bone name as thumb_01_r (it’s case sensitive, same bone spelling as on the skeletal, goal is blending 1st bone segment on each finger, thats’ why 01 )
rename the remained 4 fingers bone names:
Duplicate procedural grab 4 times and connect as follow:
Drag R_FingerData variable, split its struct pin, connect to layered blend per bone, and let it connect back to blend poseas follow:
Duplicate those yellow nodes, replace R finger data variable to left, and connect to basic left instead of basic on blend poses