I want to make a particle circle in sky so i need a function that will return only X n Z coordinates for next point on circle

PHP: $center = new Vector3(1, 1, 1);$radius = 0.5;$count = 100;$particle = new WhateverParticle($center);for($i = 0; $i < $count; $i++){ $pitch = (mt_rand() / mt_getrandmax() - 0.5) * M_PI; $yaw = mt_rand() / mt_getrandmax() * 2 * M_PI; $y = -sin($pitch); $delta = cos($pitch); $x = -sin($yaw) * $delta; $z = cos($yaw) * $delta; $v = new Vector3($x, $y, $z); $p = $center->add($v->normalize()->multiply($radius)); $particle->setComponents($p->x, $p->y, $p->z); $level->addParticle($particle);}

What player? I'm using it with Timer , you can go ahead use PlayerMoveEvent, but thats not pretty good idea

The following code makes one round per meter height, and makes up to two rounds (two meter high), spawning one particle per 1/20 meter: PHP: // $yaw is in radiansfor($yaw = 0, $y = $center->y; $y < $center->y + 2; $yaw += (M_PI * 2) / 20; $y += 1 / 20){ $x = -sin($yaw); $z = cos($yaw); $particle->setComponents($x, $y, $z); $level->addParticle($particle);}

Oh my God you are the perfect person who does not speak in riddles, and immediately writes the code. Thank you! :3

Right, the last semicolon should be replaced into a comma. My wrong. Because it's the first time I'm writing it, and I had time, and I found it interesting to write it Riddle example: Iterate from the starting height Y coordinate to the ending height. Regarding your desired spiral density, increase your yaw (in radians) by a little bit every time y increases. Using a similar algorithm to the center code above, use trigonometry to calculate the X and Z position of the particle. Adding the iterating Y, you get the XYZ to spawn the particle at.

I just got a new idea. What about making a plugin that plots a graph with particles? XD E.g. /particlegraph lavadrip "x^3 - x^2" -5 5 -5 5 0.1 0.1 Plots a graph of y = x^3 - x^2 {-5 <= x <= 5, -5 <= x <= 5} in the scale 0.1 meter = 1 unit.

My code: (your code ) Code: public function spiral(PlayerMoveEvent $event) { $player = $event->getPlayer(); if ($player instanceof Player) { if ($player->getInventory()->getItemInHand()->getId() == 351) { $sender = $event->getPlayer(); $level = $sender->getLevel(); $x = $player->getX(); $y = $player->getY(); $z = $player->getZ(); $center = new Vector3($x, $y, $z); $radius = 0.5; $count = 100; $particle = new HeartParticle($center); for ($yaw = 0, $y = $center->y; $y < $center->y + 2; $yaw += (M_PI * 2) / 20, $y += 1 / 20) { $x = -sin($yaw); $z = cos($yaw); $particle->setComponents($x, $y, $z); $level->addParticle($particle); } } } } nothing happens when holding item id 351

Oops, it should be like this: PHP: // $yaw is in radiansfor($yaw = 0, $y = $center->y; $y < $center->y + 2; $yaw += (M_PI * 2) / 20, $y += 1 / 20){ $x = -sin($yaw) + $center->x; $z = cos($yaw) + $center->z; $particle->setComponents($x, $y, $z); $level->addParticle($particle);}