I have the $player1 var and $player2 var. Now i want that $player1 looks at $player2. How to to that? I tried setRotation, but i didnt figure out, how to set the rotation properly...
Check how BlockPets does it: https://github.com/BlockHorizons/Bl...rizons/BlockPets/pets/WalkingPet.php#L66-#L67 Extracted code: PHP: $x = $petOwner->x + $this->xOffset - $this->x;$y = $petOwner->y - $this->y;$z = $petOwner->z + $this->zOffset - $this->z;$this->yaw = rad2deg(atan2(-$x, $z));$this->pitch = rad2deg(-atan2($y, sqrt($x * $x + $z * $z))); Yaw and pitch is what you need. You can ignore the xOffset and zOffset I think, setRotation() should handle that.