Here the case use puzzle game template, in which contains 1st person view facing towards the ground:
Open the puzzle Character BP
→
Add 2 cameras in the component, not parent under anythig, name as FP_camera, and VR_camera
→
Add vairables as IsPanning, InitalX, IntialY, Camlock, Speed
Create a event graph as follow:
Remark:
for - node (connect to Get mouse Position node) , type subtract: 2. ForActorWorldOffset node, R click on Delatlocation and split struct pin
Delete the top view camera (if any) in scene, replace with Player Start
To add boundary in the scene, so it won’t move away to no where:
Add mesh walls (2 walls or 4 walls within the area where want to lock):
Go back to Event graph, tick Sweep in AddActorWroldOffset node (the one at the end)