# This file is automatically generated. Please don't edit it manually. # To submit a bug report on the content, see # https://devforum.roblox.com/c/bug-reports/documentation-issues/72 name: VRService type: class memory_category: Instances summary: | Service responsible for handling interactions between Roblox and Virtual Reality (VR). description: | **VRService** is responsible for handling interactions between Roblox and Virtual Reality (VR). Its methods, properties, and events help you provide the best experience for end users seeking to experience Roblox on VR devices. See [VR Guidelines](../../../production/publishing/vr-guidelines.md) for more information on publishing an experience for VR devices. code_samples: - VRService inherits: - Instance descendants: [] tags: - NotCreatable - Service deprecation_message: '' properties: - name: VRService.AutomaticScaling summary: | Automatically adjusts scaling in VR to align the player with their avatar. description: | When set to `Enum.VRScaling.World`, `Class.Camera.HeadScale` adjusts so that the scale of the world is seen from the avatar's perspective. A player with a small avatar will perceive the objects around them as larger than a player with a large avatar will. code_samples: [] type: VRScaling tags: [] deprecation_message: '' security: read: None write: None thread_safety: ReadSafe category: Behavior serialization: can_load: true can_save: true capabilities: - Input - name: VRService.AvatarGestures summary: | When true, a VR player will be able to animate their hands and head using their controllers and headset. description: | When set to true, a VR player will be able to animate their hands and head using their controllers and headset. This property must be set on the server. code_samples: [] type: boolean tags: [] deprecation_message: '' security: read: None write: None thread_safety: ReadSafe category: Behavior serialization: can_load: true can_save: true capabilities: - Input - name: VRService.ControllerModels summary: '' description: '' code_samples: [] type: VRControllerModelMode tags: [] deprecation_message: '' security: read: None write: None thread_safety: ReadSafe category: Behavior serialization: can_load: true can_save: true capabilities: - Input - name: VRService.FadeOutViewOnCollision summary: | When true, a VR player's view will fade to black when their head collides with an object. description: | When true, a VR player's view fades to black when their head collides with an object. This property prevents players from being able to see through walls while in VR. The default value is true. code_samples: [] type: boolean tags: [] deprecation_message: '' security: read: None write: None thread_safety: ReadSafe category: Behavior serialization: can_load: true can_save: true capabilities: - Input - name: VRService.GuiInputUserCFrame summary: | Describes what `Enum.UserCFrame` is responsible for input in VR. description: | This property describes what `Enum.UserCFrame` is responsible for input in VR. For instance, if a VR headset is responsible, the value of this property will be `Enum.UserCFrame.Head`. To check if Roblox detects any VR devices, which would be responsible for input in VR, you can check the `Class.VRService.VREnabled|VREnabled` property. code_samples: - VRService-GuiInputUserCFrame type: UserCFrame tags: - NotReplicated deprecation_message: '' security: read: None write: None thread_safety: ReadSafe category: Behavior serialization: can_load: false can_save: false capabilities: - Input - name: VRService.LaserPointer summary: '' description: '' code_samples: [] type: VRLaserPointerMode tags: [] deprecation_message: '' security: read: None write: None thread_safety: ReadSafe category: Behavior serialization: can_load: true can_save: true capabilities: - Input - name: VRService.ThirdPersonFollowCamEnabled summary: '' description: '' code_samples: [] type: boolean tags: - ReadOnly - NotReplicated deprecation_message: '' security: read: None write: None thread_safety: ReadSafe category: Data serialization: can_load: false can_save: false capabilities: - Input - name: VRService.VREnabled summary: | Describes whether the user is using a virtual reality device. description: | This property describes whether the user is using a virtual reality (VR) device. If a VR device is enabled, you can interact with its location and movement through methods such as `Class.UserInputService:GetUserCFrame()`. You can also react to VR device movement using the `Class.UserInputService.UserCFrameChanged` event. ```lua local UserInputService = game:GetService("UserInputService") local isUsingVR = UserInputService.VREnabled if isUsingVR then print("User is using a VR headset!") else print("User is not using a VR headset!") end ``` This property can only be used in a `Class.LocalScript`. #### See Also - `Class.Camera.HeadLocked` - `Class.UserInputService:GetUserCFrame()` - `Class.UserInputService.UserCFrameChanged` code_samples: - UserInputService-UserCFrameChanged type: boolean tags: - ReadOnly - NotReplicated deprecation_message: '' security: read: None write: None thread_safety: ReadSafe category: Data serialization: can_load: false can_save: false capabilities: - Input methods: - name: VRService:GetTouchpadMode summary: | Returns the VRTouchpadMode indicating the mode of a specified VRTouchpad. description: | This method returns the `Enum.VRTouchpadMode` indicating the mode of a specified `Enum.VRTouchpad`. The returned mode indicates how the user interacts with their touchpad to play the game. This can also be used alongside the several `Class.UserInputService` VR methods and events. This method will only work when used in a `Class.LocalScript`. code_samples: - VRService-GetTouchpadMode parameters: - name: pad type: VRTouchpad default: summary: | The specified `Enum.VRTouchpad|VRTouchpad`. returns: - type: VRTouchpadMode summary: | The mode of the specified `Enum.VRTouchpad|VRTouchpad`. tags: [] deprecation_message: '' security: None thread_safety: Unsafe capabilities: - Input - name: VRService:GetUserCFrame summary: | Returns a CFrame describing the position & orientation of a specified virtual reality device as an offset from a point in real world space. description: | This method returns a `Datatype.CFrame` describing the position and orientation of a specified virtual reality (VR) device as an offset from a point in real world space. This method should be used when implementing VR compatibility into a game to obtain and track the movement of a connected VR device. By using the method, developers can implement features such as re-positioning the user's in-game character corresponding to the location of a connected VR device. This can be done by changing the _CFrame_ of the user's in-game character to match the _CFrame_ of the specified VR device using the UserCFrame enum and _CFrame_ value arguments passed by the event. `Class.VRService` also provides a `Class.VRService.UserCFrameChanged|UserCFrameChanged` event that automatically fires when the `Datatype.CFrame` of connected VR device changes, so long it is used in a `Class.LocalScript`. This method will only work when used in a `Class.LocalScript`. code_samples: - VRService-GetUserCFrame parameters: - name: type type: UserCFrame default: summary: | The specified `Enum.UserCFrame|UserCFrame`. returns: - type: CFrame summary: '' tags: [] deprecation_message: '' security: None thread_safety: Unsafe capabilities: - Input - name: VRService:GetUserCFrameEnabled summary: | Returns true if the specified `Enum.UserCFrame` is available to be listened to. description: | This method returns true if the specified `Enum.UserCFrame` virtual reality device (VR) is available to be listened to. It can be used to determine whether a specified VR device, such as `Enum.UserCFrame.Head`, is connected to the user's game. This can also be used alongside the several `Class.UserInputService` VR methods and events. This method will only work when used in a `Class.LocalScript`. code_samples: - VRService-GetUserCFrameEnabled parameters: - name: type type: UserCFrame default: summary: | The specified type of VR device. returns: - type: boolean summary: | A boolean indicating whether the specified VR device is enabled (`true`) or disabled (`false`). tags: [] deprecation_message: '' security: None thread_safety: Unsafe capabilities: - Input - name: VRService:RecenterUserHeadCFrame summary: | Re-centers the `Datatype.CFrame` to the current location of the VR headset being worn by the user. description: | This method re-centers the `Datatype.CFrame` of the user's head to the current location of the VR headset being worn by the user. It can be used to ensure that the user's in-game head is positioned according to the location of the user's VR headset. This behaves identically to `Class.UserInputService:RecenterUserHeadCFrame()`. This method will only work when used in a `Class.LocalScript`. code_samples: - VRService-RecenterUserHeadCFrame parameters: [] returns: - type: () summary: '' tags: [] deprecation_message: '' security: None thread_safety: Unsafe capabilities: - Input - name: VRService:RequestNavigation summary: | Requests navigation to the specified `Datatype.CFrame` using the specified `Enum.UserCFrame` as the origin for the visualizer parabola. description: | This method requests navigation to the specified `Datatype.CFrame` using the specified `Enum.UserCFrame` as the origin for the visualizer parabola. It can be used to incorporate virtual reality (VR) into your game by providing a means to visualize a navigation path from the user's VR device to a destination. `Class.VRService` has a similar event, `Class.VRService.NavigationRequested|NavigationRequested`, used to detect such requests. This can also be used alongside the several `Class.UserInputService` VR methods and events. This method will only work when used in a `Class.LocalScript`. code_samples: - VRService-RequestNavigation parameters: - name: cframe type: CFrame default: summary: | The specified `Datatype.CFrame` coordinates. - name: inputUserCFrame type: UserCFrame default: summary: | The VR device for which the navigation is requested. returns: - type: () summary: '' tags: [] deprecation_message: '' security: None thread_safety: Unsafe capabilities: - Input - name: VRService:SetTouchpadMode summary: | Sets the mode of the specified `Enum.VRTouchpad` to the specified `Enum.VRTouchpadMode`. description: | This method sets the mode of the specified `Enum.VRTouchpad` to the specified `Enum.VRTouchpadMode`. It can be used to change the user's virtual reality (VR) touchpad mode so that the user interacts with the game differently using the touchpad. This can also be used alongside the several `Class.UserInputService` VR methods and events. This method will only work when used in a `Class.LocalScript`. code_samples: - VRService-SetTouchpadMode parameters: - name: pad type: VRTouchpad default: summary: | The specified `Enum.VRTouchpad|VRTouchpad` you want to set the mode of. - name: mode type: VRTouchpadMode default: summary: | The mode you want to set the specified `Enum.VRTouchpad|VRTouchpad` to. returns: - type: () summary: '' tags: [] deprecation_message: '' security: None thread_safety: Unsafe capabilities: - Input events: - name: VRService.NavigationRequested summary: | Fired when navigation is requested from `Class.VRService`. description: | This event fires when navigation is requested from `Class.VRService` for a specified `Enum.UserCFrame` VR device. It fires with a `Datatype.CFrame` coordinate and the specified `Enum.UserCFrame` indicating the device requesting the navigation. This event can be used alongside `Class.UserInputService` service events and methods. Since this event fires locally, it can only be used in a `Class.LocalScript`. code_samples: - VRService-NavigationRequested parameters: - name: cframe type: CFrame default: summary: | The requested `Datatype.CFrame` coordinates. - name: inputUserCFrame type: UserCFrame default: summary: | Indicates the VR device for which navigation is requested. tags: [] deprecation_message: '' security: None capabilities: - Input - name: VRService.TouchpadModeChanged summary: | Fires if the `Enum.VRTouchpadMode` of a `Enum.VRTouchpad` is changed. description: | This event fires if the `Enum.VRTouchpadMode` of a `Enum.VRTouchpad` is changed. You can use this event to track the states of VR touchpads connected via the user's client. This event can be used alongside `Class.UserInputService` service events and methods. Since this event fires locally, it can only be used in a `Class.LocalScript`. code_samples: - VRService-TouchpadModeChanged parameters: - name: pad type: VRTouchpad default: summary: | The touchpad that changed mode. - name: mode type: VRTouchpadMode default: summary: | The new mode. tags: [] deprecation_message: '' security: None capabilities: - Input - name: VRService.UserCFrameChanged summary: | Fires when a `Enum.UserCFrame` is changed. description: | This event fires when a `Enum.UserCFrame` is changed, for instance when the user moves a connected VR device. It can be used alongside `Class.VRService:GetUserCFrame()|GetUserCFrame()` to track the `Datatype.CFrame` coordinates of a VR device, and when it changes/moves. It can also be used alongside `Class.UserInputService` service events and methods. Since this event fires locally, it can only be used in a `Class.LocalScript`. code_samples: - VRService-UserCFrameChanged parameters: - name: type type: UserCFrame default: summary: | The type of VR device that changed. - name: value type: CFrame default: summary: | The updated `Datatype.CFrame` coordinates of the VR device after the change. tags: [] deprecation_message: '' security: None capabilities: - Input - name: VRService.UserCFrameEnabled summary: | Fires when a `Enum.UserCFrame` is enabled or disabled. description: | This event fires when a `Enum.UserCFrame` is enabled or disabled. It can be used alongside `Class.VRService:GetUserCFrameEnabled()|GetUserCFrameEnabled()` to track whether a specified `Enum.UserCFrame|UserCFrame` is enabled, and when its state changes. It can also be used alongside `Class.UserInputService` service events and methods. Since this event fires locally, it can only be used in a `Class.LocalScript`. code_samples: - VRService-UserCFrameEnabled parameters: - name: type type: UserCFrame default: summary: | The `Enum.UserCFrame|UserCFrame` getting enabled or disabled. - name: enabled type: boolean default: summary: | A boolean indicating whether the `Enum.UserCFrame|UserCFrame` is enabled (`true`) or disabled (`false`). tags: [] deprecation_message: '' security: None capabilities: - Input callbacks: []