I am trying to make an entity that will constantly look at a player (I am going to make the entity chase the player but first I need to make sure it’s looking in the right direction). I tried using lookAt, but I might be using it wrong. Here is my code:
var Chase = pc.createScript('chase');
// initialize code called once per entity
Chase.prototype.initialize = function() {
this.player = this.app.root.findByName("playerEnt");
};
// update code called every frame
Chase.prototype.update = function(dt) {
this.entity.lookAt(this.player.getPosition());
};
@Albertos So I tried adding this.entity.rotateLocal(0, 180, 0); after this.entity.lookAt(this.player.getPosition()), but still nothing seems to be happening. What I had meant to say in the original post was not that it was backwards, but that nothing was happening at all.