Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
Croccy22's avatar
Croccy22
Honored Guest
2 years ago

Query SceneManager to locate center of floor?

Hi, Firstly I am not an experienced developer but I have messed around a bit in Unity with VR in the past.

I have just put together a simple mixed-reality demo that essentially gives me an RC car that I can drive around the room. I am using the SceneManger with the Plane and Volume prefab loaded so the car hits the furniture.

But currently, when I start my demo the car is spawned in mid-air and then falls to the floor. I would like to actually spawn the car at floor level and in the center of my room. I've searched around for sample code but haven't found anything that matches this requirement yet.

Good someone point me in the right direction of querying the scene manager to get information about the floor plane so I can get the coordinates of the center and then spawn my vehicle in this location?

 

Thanks in advance for any help 🙂

 

1 Reply

Replies have been turned off for this discussion
  • I'm not at my PC at the moment, so I may not recall the object names and options perfectly right now. If I understand your current setup, I think you wont need to calculate the place to spawn the car - I think you might need is to open the OVRManager script on your OVRCameraRig and set the play mode from "Device" or "EyeLevel" to "Floor". Then, in your scene, set the OVRCameraRig object position to the Unity scene origin, and have the car spawn at the origin. If you leave it on the default mode, when you run the program unity will assume that your eye position is the world origin, and spawn the car there (I *THINK* thats what you are currently experiencing), and it will drop. If you set your OVRManager play mode (?) from "device/eye" to "floor" and leave your OVRCameraRig at the origin, when you run the game, Unity will spawn the car on at the origin, which should now be the center of your floor, and then it will raise the OVRCameraRig object automatically to your actual eye level and position according to your height.