I made Particle with trigonometic functions, but I don't know how to move it back from player. How can I move it as much as 0.5 back?
The angle can be replaced with Player->getDirection(). And smaller radius you get if you divide both functions by the number... For example: Code: x = 1/2 * cos(angle) z = 1/2 * sin(angle) If the particle is displayed at player's front then just add PI to the angle to move it to player's back...
I don't think that helped me. here is some code, can you edit it for what I wonder? for ($i = 0; $i <= 1; $i=$i+0.2) { $yaw = $p->yaw; $right = $yaw + 180; $x = cos($right * M_PI / 180) * $i + $p->x; $z = sin($right * M_PI / 180) * $i + $p->z; $p->getLevel()->addParticle(new FlameParticle(new Vector3($x, $p->y+1, $z))); } I want to make it move back as much as -0.5 On the basis of Player.
Sorry I see it late, I meen like wings? when I make particle, it just created in player's body(?) so I want to move particle to player's back. I tried many time but it doesn't create that I wanted
So there is code I'm using... If you don't understand it, just use some plugin for that, I don't think it's good to use that without understanding the problematics. Here is base of the code... Code: x = cos yaw + dist * sin yaw z = sin yaw - dist * cos yaw Then you can create more expanded code from that: PHP: /** * @param $radius * @param $angle (Angle in degrees -> player's yaw) * @param int $size (Count of generated particles) * @param int $stacking (Particles / 1 block) * * @return \Generator [$x, $z] */ public function generateTangentForCircle($radius, $angle, int $size = 1, $stacking = 10): \Generator { $angle = deg2rad($angle) - M_PI_2; // pi/2 $particlesCount = (int) ceil(abs($stacking) / 2); for($i = -$particlesCount; $i <= $particlesCount; $i++) { $x = ($radius * cos($angle)) + ($i / $particlesCount * $size * sin($angle)); $z = ($radius * sin($angle)) - ($i / $particlesCount * $size * cos($angle)); yield [$x, $z]; } }
This code is just for generating line at player's back. Next particles you will have to generate with changing Y axis