猫史档案馆


求代码!!!!!!!

用户:老李头13zl老李头13zl查看:3 回复:1 评论:3 创建时间:2022-11-16T15:42:09


怎么让一个实体在一个范围内移动


回复

上一页1 页 / 共 1下一页
名探酱名探酱

const npc = world.querySelector('#排行榜') //填入实体名称
npc.fixed = true//不受外力影响
npc.collides = true//允许碰撞
const startPos = [1, 11, 17]//起始位置
const endPos = [1, 12, 17]//终止位置

const ani = npc.animate([// 
    { position: startPos, duration: 1 },// 1/12 的时间停留
    { position: startPos, duration: 5 },// 5/12 的时间用于移动
    { position: endPos, duration: 1 },// 1/12 的时间停留
    { position: endPos, duration: 5 },// 5/12 的时间回去
], {
    duration: 12 * 2.5, //播放一个循环共用时2.5秒,
    iterations: Infinity,//动画无限循环播放
    direction: Box3AnimationDirection.WRAP,//让动画实体从终点回到起点
})

//备注:吉吉API教程的电梯模板改的

点赞0


评论