Point direction not working

I made a point in direction script but is not working. The code is here:

EnemyLookAt.attributes.add('Player', {type : 'entity'});

// initialize code called once per entity
EnemyLookAt.prototype.initialize = function() {


// update code called every frame
EnemyLookAt.prototype.update = function(dt) {
this.entity.lookAt( EnemyLookAt.getPosition(Player) );

// swap method called for script hot-reloading
// inherit your script state here
// EnemyLookAt.prototype.swap = function(old) { };

// to learn more about script anatomy, please read:
// https://developer.playcanvas.com/en/user-manual/scripting/

Can any body help?

Hi @PhilipJeffrey!

What are you doing here to get the position?

I made a attribute and selected my player entity. Don’t know if that works though.

I think it need to look like below.


Can you try this please?

It did not work. Im putting the script on a model do you think that would change anything?

What’s the current result?

It did not point toward the player.

I think the topic below can help you.

Thank you! I will take a look!