1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Not working well with X(trigonometric function)

Discussion in 'Development' started by Hoyee, Feb 28, 2020.

  1. Hoyee

    Hoyee Baby Zombie

    Messages:
    126
    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?
     
  2. GamakCZ

    GamakCZ Zombie Pigman

    Messages:
    598
    GitHub:
    GamakCZ
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.