I am trying to tween a turret of a tank model to move up and down smoothly. The tween works, but it’s rotating in a very limited manner, regardless of the rotation value I put in. The following is how I approached it - https://playcanvas.com/editor/code/768979?tabs=43349961
The reason the tween doesn’t work is because in another script, in tank.js, you override the rotation of the turret each frame. If you comment out lines 47 & 48 it works correctly:
Tank.prototype.update = function(dt) {
var position = this.app.root.findByName("playbot").getPosition();
// this.gun.lookAt(position);
// this.gun.rotateLocal(0, 180, 0);
Hi @Leonidas, thanks for the reply. I require the turret to point at the capsule though, so those lines are required. Is there any alternate way of approaching this? I thought this would work since the tween was on the parent entity, while the lookAt code was on the turret itself.