for ($i = 1; $i <= 2; $i=$i+0.2) { $yaw = $p->yaw; $right = $yaw + 180; $x = cos(($yaw+180) * M_PI / 180) * $i + $p->x; $z = sin(($yaw+270) * M_PI / 180) * 1 + $p->z; $p->getLevel()->addParticle(new FlameParticle(new Vector3($x, $p->y+1, $z))); } I made like this but it works well on looking z coordinate but when I start changing looking to x it changes become smaller and smaller and wrong. What should I do to make working well in X too?