[SOLVED] Rotation.lerp is not a function

// update code called every frame
ShowPanel.prototype.update = function(dt) {
    var cameraPosition = this.cameraEntity.getPosition();
    this.lookEntity.lookAt(cameraPosition);
    
     var position = this.entity.getPosition();
     position.lerp(position, this.lookEntity.getPosition(), this.speed * dt);
     this.entity.setPosition(position);
    
     var Rotation = this.entity.getRotation();
     //console.log(rot);
      Rotation.lerp(Rotation, this.lookEntity.getRotation(), this.speed * dt);
      this.entity.setRotation(Rotation);
      
};

Why did it go wrong?

Hi @chuxinhao,

getRotation() will return a pc.Quat not a vector. There is no lerp method available there, but a slerp, try using that.

https://developer.playcanvas.com/en/api/pc.Quat.html#slerp

2 Likes

I see. Thank you very much for your help.

1 Like

A post was split to a new topic: Rotation.lerp is not a function in FPS