PVInstance
Hiển Thị Bản Đã Lỗi Thời
*Nội dung này được dịch bằng AI (Beta) và có thể có lỗi. Để xem trang này bằng tiếng Anh, hãy nhấp vào đây.
Một PVInstance ("Vị trí tốc độ của ví dụ") là một lớp trừu tượng không thể tạo được.Nó là nền tảng cho tất cả các đối tượng có vị trí vật lý trên thế giới, cụ thể là BaseParts và Models.
Tóm Tắt
Thuộc Tính
Phương Pháp
Nhận trung tâm của một PVInstance .
Biến đổi PVInstance cùng với tất cả con cháu của nó PVInstances như vậy mà trục trung tâm bây giờ được đặt tại điểm CFrame được chỉ định.
Thuộc Tính
Phương Pháp
GetPivot
Lợi Nhuận
Mẫu mã
Simple Character Teleportation
-- This code should be placed in a LocalScript under StarterPlayerScripts
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
-- Move the character 10 studs forwards in the direction they're facing
local currentPivot = character:GetPivot()
character:PivotTo(currentPivot * CFrame.new(0, 0, -10))
end
end
ContextActionService:BindAction("Teleport", doTeleport, true, Enum.KeyCode.F)
PivotTo
()
Tham Số
Giá Trị Mặc Định: ""
Lợi Nhuận
()
Mẫu mã
Simple Character Teleportation
-- This code should be placed in a LocalScript under StarterPlayerScripts
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
-- Move the character 10 studs forwards in the direction they're facing
local currentPivot = character:GetPivot()
character:PivotTo(currentPivot * CFrame.new(0, 0, -10))
end
end
ContextActionService:BindAction("Teleport", doTeleport, true, Enum.KeyCode.F)