Grab Component in VR template

VR flashlight



Creat BP interface, called Grab
Create 2 functions: Grab and Release, both create input: Motion Controller
image.png
Also add a function named Interact (to turn on/off light)

BP actor called Flashlight:
image.png
to Class setting, add grab interface
image.png
Event graph:
Double click all 3 interface to create their nodes
image.png
image.png
Event interact (if spot light is on, the light will be visible; and if the flash is on, untick new visibility mean next action is to turn it off)
image.png

in VR pawn:

Grab left node, for Pressed
(set nearby actor overlap to controller, will perform Grab interface)
image.png
promote variable(left grab actor) from above reroute node (grab message node, with a envelop at cotner) is to send message telling grab is functioning):
image.png
image.png
For Release,
Convert to validate of Left Grab actor variable, use release message node as well:
image.png

Duplicate on Grab right node and replace follow:
image.png

For trigger nodes (turn on off light)
image.png

Dim down the light in scene, drag the flashlight BP to test
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.