I was wondering if someone tried to use Cinemachine in VR as the main camera (the one controlled by the HMD)?
I tried the other day and put the TrackPoseDriver on the Cinemachine camera but for some reason the Camera always appears with an offset in Z so far that to see my hands I have to look behind me. I am using a virtual camera with Do Nothing on both the Body and Aim.
Any ideas what the issue could be? Main camera (without Cinemachine) works better overall.
There is no reason why you wouldnât be able to replace the Camera component in your working setup with a CinemachineVirtualCamera with DoNothing in Aim/Body. Then, make a Camera GameObject separately and add a CM brain to it.
Nothing. Fresh scene, created Cinemachine Virtual Camera. Next I added TrackPoseDriver on the Main Camera (the one created with the scene). I found a weird offset. So I thought maybe TrackPoseDriver shouldnât be on Main Camera and I placed it on Cinemachine Virtual Camera instead. Still same offset.
So I caved and removed Cinemachine and disabled Cinemachine Brain on Main Camera. Next I applied TrackPoseDriver and it actually worked. There is still an offset in the Z but it is far less than Cinemachine. Like Main Camera is set at 0, 1.3, 0 at the moment. When I play that changes to whatever in X, 1.3 in Y but Z remains at 0.6. When I was using Cinemachine that Z offset was far greater than 0.6 (was like 1.8 or 2) so hands were always behind me. Donât know why this happens.
I think you need to understand what this offset is, to gain control of your scene.
Iâm not familiar with TrackPoseDriver, so canât help you with that one.
Is it possible that the offset comes from some initial position of the object you add it to? Try placing both the Camera and the vcam at the origin before adding it.
This is why I posted here, hoping to find out where the offset comes from.
I did put both at origin and still the same issue persists. I then thought perhaps because the Cinemachine camera need to be parented for this whole issue with how HMDs check for origin (some do it as the real origin and some do it as the HMD or at least that is my understanding). So I placed the camera along with the controllers under an âOffsetâ empty game object. Same results still. Placed them all at Unityâs origin, same issue. Added a custom offset, nothing different.
Well it all looks fine at the hierarchy level. I really donât see where CM would be introducing an offset, if youâre using DoNothing in the body. Can you show some relevant inspectors?
I was about to so when I thought perhaps I should just create a new scene from scratch and work through it (for the second or third time) and I did that and surprisingly it worked this time.
Going to test a bit more and report back if there is any issue.
i recently have a project that needs to support cinemachine and VR. itâs a troublesome. for cinemachine, you are controlling the camera. for VR, you are supposed to control the standing point and allow player to move their head in 6DoF, and the scale matters.
When I try to use Cinemachine in VR I get the following warnings repeatedly:
Cannot set field of view on camera with name âMainCameraâ while VR is enabled.
UnityEngine.StackTraceUtility:ExtractStackTrace ()
Cinemachine.CinemachineBrain:PushStateToUnityCamera (Cinemachine.CameraState&) (at Library/PackageCache/com.unity.cinemachine@2.7.9/Runtime/Behaviours/CinemachineBrain.cs:866)
Cinemachine.CinemachineBrain:ProcessActiveCamera (single) (at Library/PackageCache/com.unity.cinemachine@2.7.9/Runtime/Behaviours/CinemachineBrain.cs:639)
Cinemachine.CinemachineBrain:ManualUpdate () (at Library/PackageCache/com.unity.cinemachine@2.7.9/Runtime/Behaviours/CinemachineBrain.cs:381)
Cinemachine.CinemachineBrain:LateUpdate () (at Library/PackageCache/com.unity.cinemachine@2.7.9/Runtime/Behaviours/CinemachineBrain.cs:336)
I followed the steps, more or less, and got good results. Iâm using the standard XR rig but with Cinemachine on top.
If the game detects a XR headset, on start, it shutdowns the cinemachine cameras and brain so the XR rig can control the Main camera. If there is no headset cinemachine takes over and activates two virtual cameras. The first virtual camera basically sits on the XR rig doing nothing, mimicking a regular camera. The second virtual camera follows the car with cinemachine coolstuff. When the driver toggles cameras, virtual camera one will turn off and on. This creates a seamless transition from first person driving view to cinematic follow view and back. The first and second virtual cameras manage the transition with their priority value, when only the first camera is toggled on or off. It was a big thing to add to my old game, using 2019LTS, but I am very happy with the results out of the box. Thanks for all the work and threads that help me get here. If the thread ainât dead I can post more info on my setup with the XR rig and Cinemachine. Best Moga