Rotate Entity towards other entity

@yaustar
@ Leonidas
Are you there?
I want to Rotate my 2d sprite to my player but its not working can you Please help

 var position = this.PlayerCar.getPosition();
    this.entity.lookAt(position);

Hello @Saad_Maxamtech,

What error are you encountering? this.entity.lookAt(position) should work, so long as position is a valid Vec3.

entity not rotating properly

Sometimes 2D elements may require an additional rotation to face towards the camera. It may be the case that you are seeing the backfaces of the 2D element that are culled.

Try doing this after your lookAt method, you may have to play with the 180 and try them on a different axis:

this.entity.rotate(0, 180, 0);
1 Like