You can't. To get Yaw, $player->getYaw() To get pitch, $player->getPitch() replace $player with your player object or entity object
You can take a look at how my Zombies (from Mobsters does this): https://github.com/alejandroliu/bad...c/aliuly/mobsters/idiots/Zombie.php#L209-L212
Nobody ever told you XYZ can only represent coordinates. It can also represent three-dimensional factors. https://github.com/PocketMine/PocketMine-MP/blob/master/src/pocketmine/entity/Entity.php#L869