Workspace
摘要
属性
方法
BreakJoints(objects: Instances):() |
JoinToOutsiders(objects: Instances,jointType: Enum.JointCreationMode):() |
MakeJoints(objects: Instances):() |
UnjoinFromOutsiders(objects: Instances):() |
ZoomToExtents():() |
活动
PersistentLoaded(player: Player):RBXScriptSignal |
API 参考
属性
Distributed Game Time
代码示例
分布式游戏时间
local Workspace = game:GetService("Workspace")
print(Workspace.DistributedGameTime) -- 游戏开始运行的时间
print(os.time()) -- 自纪元以来的时间(1970年1月1日,00:00:00 UTC)
print(tick()) -- 自纪元以来的时间(1970年1月1日,00:00:00 系统时间)
print(time()) -- 游戏开始运行的时间
print(elapsedTime()) -- 自Roblox开始运行以来的时间Filtering Enabled
Gravity
代码示例
低重力按钮
local MOON_GRAVITY_RATIO = 1.62 / 9.81
local DEFAULT_GRAVITY = 196.2
local MOON_GRAVITY = DEFAULT_GRAVITY * MOON_GRAVITY_RATIO
-- 创建一个触摸板
local pad = Instance.new("Part")
pad.Size = Vector3.new(5, 1, 5)
pad.Position = Vector3.new(0, 0.5, 0)
pad.Anchored = true
pad.BrickColor = BrickColor.new("Bright green")
pad.Parent = workspace
-- 监听触摸板触摸事件
local enabled = false
local debounce = false
local function onPadTouched(_hit)
if not debounce then
debounce = true
enabled = not enabled
workspace.Gravity = enabled and MOON_GRAVITY or DEFAULT_GRAVITY
pad.BrickColor = enabled and BrickColor.new("Bright red") or BrickColor.new("Bright green")
task.wait(1)
debounce = false
end
end
pad.Touched:Connect(onPadTouched)Interpolation Throttling
Pathfinding Use Improved Search
Player Character Destroy Behavior
Player Scripts Use Input Action System Alias
Rendering Cache Optimizations
方法
Break Joints
Get Real Physics FPS
Join To Outsiders
参数
objects:Instances |
返回
()
Make Joints
Unjoin From Outsiders
Workspace: Unjoin From Outsiders(objects:Instances):()
参数
objects:Instances |
返回
()
Zoom To Extents
Workspace: Zoom To Extents():()
返回
()
活动