エンジンクラス
PVInstance
*このコンテンツは、ベータ版のAI(人工知能)を使用して翻訳されており、エラーが含まれている可能性があります。このページを英語で表示するには、 こちら をクリックしてください。
概要
APIリファレンス
プロパティ
方法
GetPivot
戻り値
コードサンプル
シンプルキャラクターテレポート
-- このコードはStarterPlayerScriptsの下のLocalScriptに配置する必要があります
local Players = game:GetService("Players")
local ContextActionService = game:GetService("ContextActionService")
local player = Players.LocalPlayer
local function doTeleport(_actionName, inputState, _inputObject)
local character = player.Character
if character and character.Parent and inputState == Enum.UserInputState.Begin then
-- キャラクターを向いている方向に10スタッド前進させる
local currentPivot = character:GetPivot()
character:PivotTo(currentPivot * CFrame.new(0, 0, -10))
end
end
ContextActionService:BindAction("Teleport", doTeleport, true, Enum.KeyCode.F)PivotTo
パラメータ
戻り値
()
コードサンプル
シンプルキャラクターテレポート
-- このコードはStarterPlayerScriptsの下のLocalScriptに配置する必要があります
local Players = game:GetService("Players")
local ContextActionService = game:GetService("ContextActionService")
local player = Players.LocalPlayer
local function doTeleport(_actionName, inputState, _inputObject)
local character = player.Character
if character and character.Parent and inputState == Enum.UserInputState.Begin then
-- キャラクターを向いている方向に10スタッド前進させる
local currentPivot = character:GetPivot()
character:PivotTo(currentPivot * CFrame.new(0, 0, -10))
end
end
ContextActionService:BindAction("Teleport", doTeleport, true, Enum.KeyCode.F)