Creating an repeatedly moving object
Place the object
Place the objects where the stepping stone should disappear and change the title.
Code
const movebox = WORLD.getObject("BOX(f7b)");
const patrol = new TWEEN.Tween(movebox.position)
.to({ x: "-10" }, 2000)
.repeat(Infinity)
.yoyo(true)
.start();
π«
If you turned on the Body
in Physics
and it appears stationary, donβt
worry. Simply add a few lines (onUpdate
) to the tween, as demonstrated below.
const movebox = WORLD.getObject("BOX(f7b)");
const patrol = new TWEEN.Tween(movebox.position)
.to({ x: "-10" }, 2000)
.repeat(Infinity)
.onUpdate(()=>{movebox.body.needUpdate = true;})
.yoyo(true)
.start();