How do i make a npc ( human entity ) face a player?

Ok so im trying to make a human face a player ive tried a few methods like:
Screenshot - e3fc6f9fac59cd86f39aaecfc1588534 - Gyazo ,
and also subtracting 1 rotation vector from another
and they haven’t worked,
currently im updating were the human entity is looking every 0.1 seconds ( 100 milliseconds )
Help :frowning:
p.s. i have read the docs and theres no method like there was in spigot ( entity.setDirection )

Yes there is, it’s entity.setTransform().

i set the transform to what?

@pie_flavor No. Transform uses Euler angles for rotation, and is not equivalent to entity.setDirection(...).

@NoOneYouKnow Try human.lookAt(player.getPosition())

https://jd.spongepowered.org/6.0.0/org/spongepowered/api/entity/living/Living.html#lookAt-com.flowpowered.math.vector.Vector3d-

Yay thank you that worked, bit strange swjtching from spigot xD

1 Like

oh yeah also, any clue why the head is constantly moving up and down? i do update it ever 100ms , maby thats too fast to update?

its like the entity is looking me up and down, its strange, maby its snapping back into its old position?