[Tutorial] How to make an entity face the player (or another entity)

Started by SnailsAttack on

Topic category: User side tutorials

Joined Oct 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
[Tutorial] How to make an entity face the player (or another entity)

Out of all the ways I've tried to get entities to face the player, the best way seems to be to just execute the following command as the entity you want to face the player.

/tp @s ~ ~ ~ facing entity @p[distance=0..16]

It's the only method that doesn't produce jittering or neck-snapping head turns.

Here's a few modified examples:

Make current entity face the nearest creeper at a distance between 3 and 24 blocks (executed as entity)

/tp @s ~ ~ ~ facing entity @e[type=creeper,limit=1,distance=3..24]

Make all non-player entities at a distance between 6 and 12 blocks face the player (executed as nearest player)

/execute as @e[type=!minecraft:player] at @s run tp @s ~ ~ ~ facing entity @p[distance=6..12]

Joined Oct 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Amazing! Amazing! This is…
Fri, 03/22/2024 - 12:45

Amazing! Amazing! This is exactly what I have been looking for, thank you