Yes, like the title, are there any ways to get entities in the look direction of player ?( linear) Thanks
By looking at the documentation of the VoxelRayTrace class it could be what you need: https://github.com/pmmp/Math/blob/95ae5600328ed2add44c0bc830a68d3660e9e0ef/src/VoxelRayTrace.php#L38 You'll want to iterate over the returned Generator instance like this: https://github.com/pmmp/PocketMine-...c014aab/src/pocketmine/entity/Living.php#L822 And for each Vector3 in the loop you check if there is an entity nearby using a tiny maxdistance, and probably break the loop when you found an entity. This could be useful to check it: https://github.com/pmmp/PocketMine-...6bb06630/src/pocketmine/level/Level.php#L1960
no need for all these above... PHP: /** @var Entity $player *//** @var Player $player */$entity->setRotation($player->yaw, $player->pitch);
I've got it now... Spawn an invisible human on the place the player is watching at. Calculate the distance and get the yaw and the pitch using atan2() Then set the rotation and remove the entity from the packet.