The code is
PointAndClick.prototype.movePlayerTo = function (worldPosition) {
this.targetPosition.copy(worldPosition);
this.distanceTravelled = 0;
this.direction.sub2(this.targetPosition,
this.playerEntity.getPosition());
this.distanceToTravel = this.direction.length();
if (this.distanceToTravel > 0) {
console.log(this.targetPosition);
this.direction.normalize();
this.playerEntity.lookAt(this.targetPosition);
} else {
this.direction.set(0, 0, 0);
}
};
It doesn’t work.
Help me