Camera look to te playera position

Is this script line valid for telling the camera to follow the character?

camera.lookAt( player.position );

Hi @Trap_Spirit,

lookAt is a method is available on any entity (not only entities with a camera component), and it basically rotates the entity to look at the specified position in world space.

https://developer.playcanvas.com/en/api/pc.Entity.html#lookAt

So, if you put this line in your script update method, then yes it will rotate a camera to look towards the player.

1 Like