I guess the title says it all. PHP: /** @var Vector3 $center */$diameter = 10;$radius = $diameter / 2;//π = M_PI;
Take a look at this: https://forums.pmmp.io/threads/creating-basic-shapes.705/ You should be able to, by decreasing the for loop increase to for example $x += 0.05 instead of $x++, make the particle density bigger which would look better.
I finally managed to do it by converting this code I found on Bukkit Forums to PHP. Here's the code for future readers... PHP: /** * PMMP should add this to their * Position.php */ private static function getDirection($pos) : Vector3 { $y = -sin(deg2rad($pos->pitch)); $xz = cos(deg2rad($pos->pitch)); $x = -$xz * sin(deg2rad($pos->yaw)); $z = $xz * cos(deg2rad($pos->yaw)); return new Vector3($x, $y, $z); } private static function genCircle(int $radius, int $vertLines, int $dotsPerLine, $center) { $pitchDelta = (float)180 / $dotsPerLine; $yawDelta = (float)360 / $vertLines; $results = []; for ($i = 0; $i < $vertLines; ++$i) { for ($j = 0; $j < $dotsPerLine; ++$j) { $loc = clone($center); $loc->yaw = -180 + ($i * $yawDelta); $loc->pitch = -90 + ($j * $pitchDelta); $v = self::getDirection($loc)->normalize()->multiply($radius); $results[] = $v; } } return $results; } public static function makeSphere($player, $radius = 5) { $data = self::genCircle($radius, 20, 20, $player->getLocation()); foreach ($data as $pos) $player->getLevel()->addParticle(new MobSpellParticle($player->add($pos->x, $pos->y, $pos->z), 255, 255, 255)); } PHP: self::makeSphere($player);