Skip to content

WaypointMotorUnit

概览

字段
KindUnit · 单位 Unit
Realmcommon

继承关系

  • Unit(4 属性 / 25 函数 / 6 事件)
    • BaseMotorUnit(10 属性 / 5 函数 / 2 事件)
      • [WaypointMotorUnit](1 属性)

继承成员

2 个来源 / 14 属性 / 30 函数 / 8 事件

路径点运动器,用于驱动已在编辑器或预配置实例中设置好路线的对象沿路径运动。

适用场景

适合移动平台、巡逻物体和按固定路径往返的机关。

使用要点

在服务端获取已经配置好路线的 WaypointMotorUnit 实例,确认目标实例存在后调用 Start()、Pause()、Resume() 或 Stop() 控制运动流程。

注意事项

WaypointMotorUnit 继承 BaseMotorUnit 的启动语义:路线数据应由编辑器或预配置实例提供;当前公开 Lua Meta 只暴露运动器通用控制成员,不提供脚本直接写入路线点结构的稳定接口。

代码示例

服务端启动已配置的路径点运动器

lua
-- @runtime server
local World = game:GetService("World")

local motor = World:FindFirstChild("MovingPlatformMotor", true)
if motor == nil or not motor:IsA("WaypointMotorUnit") then
    print("请先在编辑器中配置 WaypointMotorUnit 实例")
    return
end

motor.OnMotorStart:Connect(function()
    print("路径点运动开始")
end)

motor:Start()

属性 (1)

Name类型默认值说明

关联类型