Rotate the enemy towards the player issue

Hi, I’m facing this issue to move the enemy toward the player. I have to apply torque to move it during runtime but facing this issue still. Your help would be highly appreciated thanks.

Hi @regeme!

I don’t know what the issue is (because you didn’t tell), but I see you use lookAt on an entity with a dynamic rigidbody. Unfortunately, that’s not possible.

A workaround can be to use lookAt on a child entity and use the forward direction of that entity.

https://playcanvas.com/project/808772/overview/look-at-with-physics

The issue is when I move to the player the enemy is also moving towards me but his face is not turn towards me

That’s probably because the dynamic rigidbody of the entity doesn’t respond to lookAt.

can you fix it if possible .it would be helpful thanks

I already shared some information about how to fix it.

1 Like