Using Unity's XR Device Simulator Develop VR on a Mac or Without a Headset

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi there so in this series of unity tutorials I've been showing you how to set up um VR support but I promised along the way that we would make sure we were supporting for Max and for computers that don't have VR headsets attached um so uh in this tutorial I will show you how to use the XR device simulator to allow you to develop VR projects on a Mac or on a PC where you don't have a headset around so in my tutorial where I showed you how to set up a XR support in unity one of the things we got was a package called the XR interaction toolkit and we twirled open samples and downloaded not only starter assets but we also downloaded the XR device simulator and now we're gonna go find that it's in our project window under assets and then samples XR interaction toolkit the version we chose and then XR device simulator and inside this we have a prefab um this is our XR device simulator prefab and just like our XR origin setup we can click and drag this and drop it into our sample scene now the trick is that uh this object and that object are sort of competing to do the same thing um so while your XR device simulator is enabled it takes precedent but if you have your headset still attached you know like if if you're just trying this out on a PC and you do have a headset set up you know in link mode or something like that um when you hit play it will play on the screen like a sort of first person shooter style experience but in your headset it's gonna make you super seasick because um the the two cameras uh conflict with each other and like the head tracking doesn't work correctly anymore and the whole world just kind of like moves with your head in a way that's very disconcerting so if you experience that if you hit play and your head in your headset is very low to the ground and the world is moving like opposite of the way it should in a VR project um it's because your XR device simulator object is still enabled this is also very likely to happen when you finally build in the end um so when you know we're not there yet but when we finally want to build this for Quest or for a standalone headset we want the XR device simulator to be at the very least not enabled or maybe just deleted um to make sure but uh almost certainly somewhere along the way if you're developing with the device simulator you will accidentally make a build that has it enabled and you'll know because when you put your headset on the whole world will sort of rock back and forth and you'll be very low to the ground so with that warning out of the way we always want to be cognizant of what we have our XR device simulator toggled so when we're trying to preview in headset or build to headset the device simulator should be toggled off and you know its name in in the hierarchy should be sort of dim and grayed out but when we're working with it kind of in preview mode and we want to use the device simulator we make sure to enable it so with the device simulator enabled here's how it works um you hit play and it's going to show you a kind of mock-up first person shooter style and your mouse moves your head around um was and D are kind of the standard movement controls in PC gaming and those are gonna strafe you left and right and move you back and forth um so so far so good we're able to move around and uh and look you know and turn with our Mouse strafe with our controls and um you know my first challenge to you if you're following along would just be to like try to get used to these controls make sure you can walk towards your different objects and move around where you want um the trick comes when you want to start controlling the controllers separately that's where this panel that's on the left hand side really comes in handy to give you a cheat sheet for your controls so let's say I wanted to use this laser pointer and point it down at the cube there are two options here I can see on the left hand side where it says cycle XR input I can use tab to cycle through what I'm controlling so right now the blue Highlight moved from the head mounted display the hmd to the controller and indeed if I use my mouse now I'm rotating the controller so I can point that laser pointer down or up or wherever I want um if I hit tab again I'm rotating the other controller and if I hit tab again I'm back to the headset so I can just tab through my kind of three parts of of my avatar my head and my two hands um you can also take temporary control of those controllers with the T and Y toggle so if I hit T I'm on the left one if I hit T again I'm back to wherever I was why I'm on the right one and back to where I was um while I've toggled to the controller in question you can see uh in this cheat sheet on the left side what the controls are so my left joystick is wsa and d and luckily I've got movement control bound to my left joystick which we set up in the last tutorial so I can still move around but you'll notice that the trigger button is the left Mouse so if we add something set to trigger that would do it and the grip button is G um the other face buttons on like a standard Oculus type controller are mapped to um n and m and b um so that's going to allow us to mock up controls um and uh test out our project without having to have a headset or indeed without even having to have a computer that can have a headset because at the time of recording macintosh's do not allow you to just hit play and preview on a headset if you want to develop on a Mac I highly recommend that you do your um sort of iterative small test play modes using the device simulator and then when you have to test something larger that doesn't work real well with mouse control or you know maybe every half hour or hour or so you've done enough that you really want to try it on headset in that case the way you do it is you have to actually build and run um so in a future tutorial I will show you how to set up build settings so that they're you know going to publish directly to your quest too but yeah for Mac development on the Quest 2 or or other equivalents I think the best way forward is the XR device Simulator for small tests and then for major tests to actually make a build to the headset there are a number of settings in the XR device simulator that come with defaults but I want to make you aware of one of them in particular when you click on XR device simulator and then twirl open sensitivity this is where we could make a distinction between how fast we move in headset and how fast we move when we're device simulating so these keyboard translate numbers those are deciding how quickly we're moving and in headset like I said in a previous tutorial we might want the continuous movement to be relatively slow so it doesn't make our our players nauseous but when we're just looking at it on the screen in the device simulator it might feel really really slow to us because we're not worried about nausea then so you could turn this up and the device simulator would essentially walk fast faster than the headset really does so by default it's on five and all the directions that it can move in or point to so I think the math of that would be that it comes out to a movement speed of one which is what we have our headset set as too but uh if I double this to 10 now we're moving twice as fast as we would be in headset which feels much more reasonable in the device simulator whereas in headset that might start to be too fast for some players one word to the wise is as you're getting used to controlling your mouse to move all over the place if your mouse sort of gets stuck because you've clicked out on the unity interface you can click back in the game window to control again if you're having trouble getting back out to the unity interface to say turn off play mode you can hit escape to get your mouse back without controlling um your hmd
Info
Channel: Ryan Murray
Views: 14,379
Rating: undefined out of 5
Keywords:
Id: n8RWRt8IwrQ
Channel Id: undefined
Length: 10min 22sec (622 seconds)
Published: Tue May 02 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.