Grab Component in VR template

Grab Objects from a Distance



Create Distance grab component:


Create a BP staticMeshComponent, name DistanceGrabComponent
image.png
Choose arrow for its mesh
image.png
Create 3 variables
image.png
image.png
So far it’s to check if anything has grabable components by hitting everything in the scene within a direction, by running loop, then either ignoring those actors, or target them for next action

Continue:
image.png
image.png
image.png

Set detecting boolean be true
image.png

To a loop back to serach again any targeted grab if all parameters are true/false, connect all not valid/not true nodes back to earlier nodes as looping
Final:
image.png

Create new function, called SetDetecting
image.png
2nd function: Grab:
image.png
promote local variable for Grab Comp
image.png
image.png

Back to event graph, add following for false branch:
image.png


Go to VR Pawn:

Open viewport, add distance grab components on both hands:
image.png
image.png
In event graph, add following in inputaction grab nodes:
image.png
Ending nodes:
image.png

Duplicate on right hand
image.png

Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.