How to make my rolox game VR?

Hey! So I was just messing around and saw this video:

I don’t really need to make exactly what he did, but I’d like to know how he did the motion sensing. Can anyone explain? I’m pretty sure there is VRService.

Edit: Yep, there is VRService.
I’ll go check for some UserInputService stuff for it

Heres an easier question

local UserInputService = game:GetService('UserInputService')

local LastInput = UserInputService:GetLastInputType()


LastInput = inputtype

if LastInput == Enum.UserInputType.


What would the vr UserInputType Be?


That depends, are you going to be doing a hacky camera tracking thing, or proper support for VR headsets?

because if you want to do the camera thing you’d probably be best asking @Spooks_HD himself.

if you’re doing it the proper way

VRService:GetUserCFrame gives you the relative CFrame offsets of various input devices from the 0,0,0

if you add what you get from VRService:GetUserCFrame to Camera.CFrame then you get how said part is tracked IRL, and if you attach a hand part to that cframe, it’ll track to where your hand would be.

you don’t have to worry about tracking of the headset itself, it does that automatically. Hand tracking is manual though.

as for the UserInput for VR, it uses standard gamepad bindings and keycodes, like Enum.KeyCode.ButtonR2 and so on.


I made that video to show off my own personal progress in learning how to do hand-tracking (probably pretty evident). If you want to do do VR you probably want to go with VRService and use what Greg already posted to aid you on the way. You could also add support for mobile VR or head-rotation / movement by using the phone’s gyroscope (and some other properties that I’m forgetting) to achieve the “vr-like” movement in your game.

Also - just as a note - the hand tracking was not done within Roblox (just to make it clear). It was done in a separate program that I made especially for this.

Wow, didn’t actually expect you to reply to this. Thanks for the reply! And also, great job with what you did in the video.

Thanks, I’ll look into GetUserCFrame. I’ll try to make a ‘horror’ game with VR support.