Why does the scene camera change position and rotation on play - unity3d

Win 10 Pro, Unity 2019.2.17f1
This issue occurs on occasion, randomly. It has happened with multiple different scenes on this machine.
In this instance, I have a scene that is completely empty except for the default Main Camera and Directional Light. I have not added any scripts to the scene. In the inspector the camera is at position 0, 10, 0 with rotation 90, 0, 0 by default. Once I hit play, the camera instantly jumps to a seemingly random position and rotation. If I delete the main camera and make a new camera game object, the same thing happens to it. Please see this screen recording demonstrating the problem:
https://youtu.be/JMl2arXzeCo
I'm thinking it might have something to do with the fact that I have SteamVR running on my machine. Does anyone know what causes this, and where I might be able to find a setting to toggle this behavior? Thank you

In the console you get
OpenVR Initilaized
You seem to have Virtual Reality Support enabled in the ProjectSettings -> Player -> XR Settings thus the camera position and orientation is controlled by a virtual reality device.
From the orientation I would guess that it lies around somewhere ^^
Simply disabling this should fix your issues.

To add to derHugo's answer: to stop the camera from following the VR device without disabling VR support, set the Camera component's Target Eye property to None (Main Display).

Related

How to change the AR Foundation Camera Rotation and position using joystick in Unity3d

I am creating a project like AR Portal in the AR foundation.
there are two modes in this:
AR Mode
Joystick Mode
Everything is going well with AR Camera and in AR mode.
In joystick mode, I am unable to rotate the camera and I am stuck on that problem and didn't find any solution.
If I disabled the Tracked pose Driver of AR Camera, then it will work but if I enable the Tracked Pose Driver, then it will not work.
Is it possible to rotate the camera when Tracked Pose Driver is enabled?
I'm not sure what you're trying to do there. AR camera is usually a physical camera, changing its position and rotation by code would not make a lot of sense. If you are using the joystick for a different scene/ part of the scene, try using a regular Unity camera and write a simple controller to move it around.

Stop particles from rolling with camera (unity)

I have a particle effect. The particles face the camera with this setting
renderer-> render alignment -> face
or
renderer-> render alignment -> view
It's great that it faces the camera. But when I introduce a roll in my camera. For example for a VR game or a Space sim. The particles roll with the camera. Which looks horrible.
Is there a way that I can prevent this roll?
I want to point out that 2018.3 and on has an option in the render settings to "allow roll". Disabling this will solve the issue you have here.
Apparently this isn't currently possible in unity's particle system. It's a known problem especially for virtual reality. I coded my own particle system to go around this problem.

SteamVR SDK: HMD Camera Location is out of chaperone bounds, but the controllers aren't

Nothing's worse than setting up an SDK exactly the way the developers ask you to and having it not work... I'm posting this question to share an issue I found setting up a bare bones VR scene in Unity 2017.1.1
The Scene's contents: CameraRig, SteamVR prefab, and a plane for the floor.
The problem: The SteamVR bounds are clearly displayed, and from the HMD's perspective I'm not within the bounds. Incidentally, my controllers are in bounds where they should be...
If you look under 'Camera (eye)' in the inspector, you may see the camera's Depth attribute set to -1. Just set it to 0 and you should be golden.
The original settings, to my understanding, cause your camera to render a meter away from the intended HMD position.

Unity 2D - Camera isn't where it's supposed to be

In Unity 2D, I am working on a game that uses a square shaped camera that hovers over a tilemap (Zelda NES style). In the camera preview in the game view, it shows what it's supposed to:
But when I switch to the game view, this is what it shows:
Here are my camera settings in case it helps.
Does anybody know why this is happening and how I can fix it?
I finally figured out how to fix it. All I needed to do was set "Depth" on the camera settings to 0 (it was at -1 before).
You scene must have multiple cameras and one of those camera's depth would be > -1 hence its showing that camera and not your maincamera, if you just have one camera the depth does not matter

Physics messed up with cardboard scene in Unity

I am in the process of putting together an app using the Google Cardboard SDK. The user will be able to use the app with or without cardboard. So, there is a switch button inside the app, that activates and deactivates stereo rendering.
The app also uses the Vuforia SDK to track image targets. If a specific target is recognized, some 3D objects above the target and a particle system starts to emit particles.
Everything works fine in non-stereo mode. Particles are emitted and falling correctly as intended. They should simulate snow. Also if the user turns the image target to an angle, the 3D objects above fall down.
When switching to stereo mode, the physics are messed up completely. The snow particles are not falling anymore, they seem to "teleport" around the screen. Also the 3D objects do fall upwards, with a really heavy negative gravity. Timescale seems multiplied several times, but is not - I double checked that. Gravity also does not change when switching between non-stereo and stereo rendering.
Everything works fine in Unity Editor in moth modes. It only appears on the device, which is an iPhone 5.
Cardboard SDK is version 0.52, which is the newest.
Unity is version 5.3.1.
Vuforia is 5.0.6, which is not the newest, but release notes do not indicate a fix concerning physics. Will update it anyway as a next step.
Vuforia is 5.0.10, which is the latest version.
I double checked gravity and timescale, which are not changing when switching between modes. I have a hard time figuring out what might cause the physics to mess up.
EDIT:
I did some further investigations. I made me a little gizmo sitting always in front of the camera but getting the rotation of the Unity world space axes, so I know the 3D-world is oriented in relation to the camera. And it turns out, that when in VR mode with the Google cardboard camera system, the world does spin around the camera heavily. I managed to hold the test device in a way, so it is slowing down and almost freezing, but I have no explanation for the effect yet.
I managed to get my setup right again. Unfortunately I did not find the source of the weird behavior. But By deleting the Vuforia Prefab and the Cardboard Prefab and adding them again to the scene, the problem was solved.