PlayerViewService

사용되지 않는 항목 표시
만들 수 없음
서비스
복제되지 않음

PlayerViewService provides a way to get additional information about a player's view.

속성

메서드

GetDeviceCameraCFrame

Returns a world space CFrame looking at the player's character, such that setting the current camera's CFrame will view that character from the perspective of their device.

This method leverages the device's camera and it only functions on mobile devices. If no information is available, for example the user is not on a mobile device or they don't have their camera turned on, this method returns a CFrame.identity.

See Roblox Connect for a sample implementation of this method.

매개 변수

player: Player

The player for which to get the device camera CFrame.

기본값: "nil"

반환

The world space CFrame looking at the player's character, or a CFrame.identity (see description).

코드 샘플

PlayerViewService:GetDeviceCameraCFrame()

local PlayerViewService = game:GetService("PlayerViewService")
local RunService = game:GetService("RunService")
local Workspace = game:GetService("Workspace")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local camera = Workspace.CurrentCamera
local function updatePictureInPictureCamera()
camera.CFrame = PlayerViewService:GetDeviceCameraCFrame(player)
end
RunService:BindToRenderStep(
"PictureInPictureCamera",
Enum.RenderPriority.Camera.Value + 1,
updatePictureInPictureCamera
)

이벤트