In my code console.log("notiek tweeens"); and console.log("inside2", insidecoords);
both get logged and contain needed coordinates for the tween function to work, for some reason it does not affect selected object (this.man). #javascript #enable3d
gamenew.php - https://pastebin.pl/view/36b614c1
the whole project on github - https://github.com/lv88h/JurmalaStreets3dPSEUDO6
MORALE AND TECHNICAL DIFFICULTIES EXPLAINED:
so these two "methods" I found that should do tweening, first one does not log onUpdate thus does not position.set , nor does tween
const coords = man.position.clone()
const tween = new TWEEN.Tween(coords)
.to({ x: vertibasx, y: vertibasy, z: vertibasz }, 1000)
.easing(TWEEN.Easing.Quadratic.Out)
.onUpdate(() => {
console.log("notiek tween");
man.position.set(coords.x, coords.y, coords.z)
if (man.body) man.body.needUpdate = true
})
TWEEN.update(1000 * 1000)
second one sets position but breaks the game, also logs inside of onUpdate, and if we comment out setting position, nothing tweens
this.tweens.add({
targets: man.position.clone(),
duration: 100000,
delay: 100,
x: '+=400',
z: '+=400',
onUpdate: () => {
console.log("noteik tween");
this.man.position.set(vertibasx.x, vertibasy.y, vertibasz.z)
}
})
Nav komentāru:
Ierakstīt komentāru