MovingAlongRoute
大约 1 分钟
MovingAlongRoute
沿路移动的物体,常用于制作车辆行驶模拟,继承自Thing,拥有Thing
、THREE.Object3D
一切属性和方法。
构造
new VT.MovingAlongRoute({
name: "MovingAlongRoute",
// 线路点位
points: [],
// 车道设置
route: {
// 双向路径,1为单向,2为双向
way: 2,
// 车道数
lanes: 1,
// 中间隔离宽度
gutter: 1,
// 车道宽度
width: 3.8,
// Y轴偏移
y: 0,
// 曲线系统
tension: 0,
// 是否反向
reverse: false,
},
// 车辆设置
car: {
// 车速,KM/H
speed: 20,
// 是否自动播放
play: true,
// 模型配置,数组
model: [],
// 安全距离,米
safeDistance: 20,
// 生成系数,0 ~ 1
quantity: 0.5, // 数量 0, 1
},
})
属性成员
type
- 类型:
{String}
MovingAlongRoute
isMovingAlongRoute
- 类型:
{Boolean}
是否为MovingAlongRoute,只读,不可改
points
- 类型:
{Array}
线路点位,数组,每一项为THREE.Vector3
方法
updatePoints
更新点位
- updatePoints(points)
- 类型:
{Function}
- 参数:
- points
{Array<Array<Number>}
[[0, 0, 0],...]
- points
- 返回:无
updateRoute
更新车道设置
- updateRoute(route)
- 类型:
{Function}
- 参数:
- route
{Object}
见车道参数 - 返回:无
updateCar
更新车辆设置
- updateCar(car)
- 类型:
{Function}
- 参数:
- car
{Object}
见车辆参数 - 返回:无
play
播放动画
- play()
- 类型:
{Function}
- 参数:无
- 返回:无
pause
暂停动画
- pause()
- 类型:
{Function}
- 参数:无
- 返回:无
stop
停止动画
- stop()
- 类型:
{Function}
- 参数:无
- 返回:无