Hi,
Had my first run at attempting to get VR setup in Unreal. Apart from some stupid rookie mistakes, it was easy to setup. As the others are being deprecated, I’m using OpenXR.
I have a few questions regarding the camera’s though.
My Pawn is a vehicle that already has 1 camera in there (on a Springarm, behind the car). I’ve added a scene calle ‘VRCameraRoot’ and a ‘VRCamera’ as a child (set it up like it is written in de official documentation).
At the ‘Event BeginPlay’, I’ve set up an ‘Start AR Session’ (which immediatly got rid of some subtle jittering that was going on) and a ‘Set Tracking Origin’.
-
Currently it is set at ‘Floor level’, as both ‘Floor level’ and ‘Eye level’ don’t give the result I’m after. I’m either at the ground or way above my car. It’s also not even on the location of my VRCameraRoot, but more forward along the X-axis. When I switch to my ‘behind the car’ camera, it also appears more forward than the camera actually is.
So what is going on? I’m currently using ‘magic numbers’ to my camera on the right location in the car. This doesn’t seem right, as I’m having to guesstimate.
Are there options I’m missing in the camera settings?
-
As the camera’s are in the Pawn/vehicle BP, the camera is ‘stickied’ to that mesh. Which is obviously what we need. But as the ground isn’t always leveled and this car is setup to have little suspension, you shake as much as the car does.
Is there a way I can have the camera counter-act that a bit? So that your view is shaking a lot less than the car. Like having a suspension on the camera itself.
The tutorials I keep finding, are generally just ‘playing’ with the VR template. Which aren’t helpful.
Hope someone can help or point me in the right direction.
Cheers.
VRCameraRoot will always be located at the real-world origin of your VR tracking space. If the tracking space is set to floor level, it will be on the floor at the center of the playspace, and with eye level, it will be in a runtime-set zero point. OpenXR does not support setting the zero point from the application, and only some runtimes supports the user setting it.
Generally the best option for a seated game is to add a calibration option in-game. It can be implemented by taking the local transformation of the camera component, inverting it, and applying it as the local space transform of the VRCameraRoot.
For the second issue, I would not have the camera hierarchy attached to the car, but instead, every frame move it to the car attachment point, as well as applying yaw rotation. To smooth out the movement and rotation, you will likely need to apply filtering to it. UE has some blueprint nodes available for it:
Ok, thanks.
But is there a tutorial of some sort about that. I’m kinda new to it all and the only tutorials I can find, are just ones that show the VR template and ‘play’ a bit with it, but not much more.
In Godot, I also used OpenXR and I was able to set the camera in-engine where I needed it.
I’m a visual learner, so I also generally go by visual cues. Also why I like Blueprints.
As I understand your explanation, I just have to put the VR camera in an actor/pawn of it’s own? But my car is also my pawn, can I have multiple pawns?
And then have the Blueprint in the VR cam pawn, to follow the car? By ‘car attachement point’, you mean the origin point of the car pawn?
I haven’t seen any tutorials at least.
You should still keep the camera inside the pawn, but decouple it from moving with the rest of it by setting the location and rotation to absolute instead of relative.
By attachment point, I mean the point where you want the players viewpoint to be. One way is to stick a scene component where you previously had the camera.
I had setup my VR camera as is described in the documentation. So I did have my VR camera being a child of a SceneComponent. Which in its turn, a child of the mesh and so on.
Here is a screenshot of my setup:
Does the SceneComponent (VRCameraRoot) need to be absolute location/rotation (scale?) or the VR camera itself?
It would have to be the VRCameraRoot.
Adjust the VR camera’s relative position to align with the vehicle’s geometry and use a SpringArm with damping to reduce shake for smoother VR experiences.