Set Overlap collision on VR Pawn:
Add Sphere collision on both left and right controllers, scale down the size to fit the collision influenced area:
Make button:
Create a BP actor, called Button
Make 2 static mesh with different mesh and materials:
Put it in the scene
Back to viewport, add box collision child under button, adjust its size as shown (Z axis should be thin enough, just barely cover the button service)
and then create a click for event graph:
Now should the VR controller on the box collision, button should be pressed, but the button won’t returned back after pressing once
To modify:
add is pressed boolean vairalble, and extend the graph:
If overlap on box, see if the button pressed, if true, no further action; if false, will do the pressing
To make the button can be pressed again, extend the ending graph:
Make Door:
Create a BP actor called Door
Add custom event, name as Opening
Test the movement by connect beingplay node as below, play by simulation (once the move as expected, remove the node)
Connect opening event node to replace event beginplay
Back to button BP event graph, 1st move component to node, insert below:
To make the door close back after open when press the button again:
Back to door BP, add flip flop and change + to - in move:
P.S. The button don’t know why can’t bounce back sometimes after press, this method from other tutorial to create another button design:
After create button BP,
add Arrow component in veiwport, rotate 90
Don’t know why button cannot move the location, so has to move the arrow and Body to align them together, but then it’s no longer in centre of defaultsceneroot
Go to construction script, add float variable buttonOffset, default value 100
(to control how far the button be pushed down)
Then in event graph:
(this method also doesn’t work)