hi gusy i want one code . example code : if FlameParticle touch Bedrock Block ! stop the FlameParticle Moving
PHP: for($i = 0; $i < 40; $i++){$level->addParticle(new FlameParticle(new Vector3($i * $x + $px, $i * $y + $py, $i * $z + $pz)));// if particle touch bedrock block ! stop particle moving}
Thanks for the note, but I do not want to respond to it without that help me in the thing that I needed and thanked
In short - you can't. Particle's don't exist server-side, they aren't tracked by the server. Even if they did, it's impossible to set the motion of a particle.
Try to make a formula for calculating the movement and check when its inside the Bedrock block by calculating: Get or guess the speed of the particles and divide the $v3->distance($v3); by it. Please show the whole code!
Example : PHP: public function ParticleCl(Player $player, Particle $particle){ $position = $player; $unitVector = $player->getDirectionVector(); for($i = 0; $i < 40; $i++){ $position = $position->add($unitVector); $particle->setComponents($position->x, $position->y, $position->z); $player->getLevel()->addParticle($particle); if($particle /* touch Diamond Block ? */) { $particle->kill or stop } } }
https://github.com/NawafCraft/Pocke...c/pocketmine/level/particle/FlameParticle.php https://github.com/NawafCraft/PocketMine-MP/blob/master/src/pocketmine/math/Vector3.php