I’m trying to make a VR demo of a concept car.
In this demo there is a car (pawn) that the player is sitting in.
This is working fine, the pawn is possessing the player and everything seems to be going fine, until the VR player physically moves, then it also moves with the pawn and goes through the seats, the centre console or even the windows.
How can I make sure that the player is “stuck” in his or her seat? The idea is that the player should only be looking around.
I have added a Disable Movement node to the BeginPlay event of the level blueprint with the player as the target. But this does nothing.
The template is a copy of the standard VRTemplate, with the accompanying VRGameMode, VRPawn, PayerState and so on.
For VR I use an Oculus Quest 2 and work in UE5.1.
The easiest way to do this would be to every frame: Get the location of the camera, subtract it from the location you want it to be at, and offset the entire player pawn by the resulting vector.
This is generally a bad idea though. VR headsets are designed around having 6 degrees of freedom in motion. Limiting it to 3 will make any head rotation pivot around the point between the users eyes, and feel extremely unnatural and nauseating.
Generally, the most comfortable option for restricting player movements is to fade out the vision when the head intersects with something solid. Another option is to limit the movement to a certain volume and push the camera back when the player goes outside of it, but that kind of forced movement can be nausea inducing to many users.