how to make entity look where your looking looking

Started by Freddy101 on

Topic category: Help with Minecraft modding (Java Edition)

Active 5 months ago
Joined Aug 2023
Points:
266

User statistics:

  • Modifications: 0
  • Forum topics: 15
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 27
how to make entity look where your looking looking
Tue, 01/23/2024 - 06:34 (edited)

for this procedure, i wanted to spawn a mob in front of me and have it looking the same place I was looking when I spawned it but I cant seem to move the entitys head and where its look at all.

 

i would also settle for being able to spawn the entity rotated where I am looking but when I do it only spawns on the x axis so I cant face it upwards or down

 

Edited by Freddy101 on Tue, 01/23/2024 - 06:34
Active 6 months ago
Joined Oct 2023
Points:
302

User statistics:

  • Modifications: 1
  • Forum topics: 1
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 274
Set the direction the player…
Tue, 01/23/2024 - 17:22

Set the direction the player is looking at in a variable. Make the entity look in that direction/variable. 

Active 5 months ago
Joined Aug 2023
Points:
266

User statistics:

  • Modifications: 0
  • Forum topics: 15
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 27
how would i do that  
Tue, 01/23/2024 - 20:44

how would i do that

 

Active 5 months ago
Joined Aug 2023
Points:
266

User statistics:

  • Modifications: 0
  • Forum topics: 15
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 27
how would i do that
Tue, 01/23/2024 - 20:45

how would i do that

Active 5 months ago
Joined Aug 2023
Points:
266

User statistics:

  • Modifications: 0
  • Forum topics: 15
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 27
and do you mean a local…
Tue, 01/23/2024 - 20:48

and do you mean a local variable

Active 6 months ago
Joined Oct 2023
Points:
302

User statistics:

  • Modifications: 1
  • Forum topics: 1
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 274
Yes I do mean that. On play…
Tue, 01/23/2024 - 21:03

Yes I do mean that. On play update tick, set varible to entity direction entity is facing. On (Your) entity update tick, set the direction they face to that varible.

Active 1 week ago
Joined Jul 2024
Points:
85

User statistics:

  • Modifications: 0
  • Forum topics: 2
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 22
Can you please be a bit more…
Sat, 09/07/2024 - 02:17

Can you please be a bit more specific?

Active 3 months ago
Joined Apr 2023
Points:
283

User statistics:

  • Modifications: 0
  • Forum topics: 7
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 22
Some more info on this will…
Thu, 01/16/2025 - 02:06

Some more info on this will be helpful.

Active 1 month ago
Joined May 2025
Points:
15

User statistics:

  • Modifications: 0
  • Forum topics: 0
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 5
I agree
Sun, 05/04/2025 - 13:58

I agree

Active 1 month ago
Joined May 2025
Points:
15

User statistics:

  • Modifications: 0
  • Forum topics: 0
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 5
How do I set an entity's…
Sun, 05/04/2025 - 13:58

How do I set an entity's direction to be the same?

Active 6 hours ago
Joined Apr 2023
Points:
661

User statistics:

  • Modifications: 4
  • Forum topics: 22
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 540
Using the clearly labeled…
Sun, 05/04/2025 - 14:39

Using the clearly labeled procedure blocks for it.

There are procedure blocks to get and set an entity's pitch and yaw, which are look directions. You need to get the player's pitch/yaw, and set the entity's pitch/yaw to be the same.

Alternatively, you can use procedure blocks to get the look X, look Y, and look Z positions of the player, then use a clearly labeled procedure block to force the entity to look at that X Y Z position.

The first option makes the entity imitate the player's head position, while the second one makes the entity look at the same block. There would be a clear difference between the two in-game if you and the entity are on opposite sides of the block you are looking at.

You can use local number variable to store the pitch/yaw/X/Y/Z values.