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

Spiral Particle Not Spawned At The Right Position

Discussion in 'Development' started by Bintang Putra, Jun 20, 2017.

  1. Bintang Putra

    Bintang Putra Witch

    Messages:
    63
    GitHub:
    chaostixzix
    Hi, I'm trying to spawn a Spiral Shaped DustParticle

    Here's My Code
    PHP:
    $x $player->getX();
    $y $player->getY();
    $z $player->getX();
    $center = new Vector3($x$y$z);
    $radius 0.5;
    $count 100;
    $particle = new DustParticle($centermt_rand(), mt_rand(), mt_rand(), mt_rand());
    for(
    $yaw 0$y $center->y$y $center->4$yaw += (M_PI 2) / 20$y += 20) {
        
    $x = -sin($yaw) + $center->x;
        
    $z cos($yaw) + $center->z;
        
    $particle->setComponents($x$y$z);
        
    $level->addParticle($particle);
    }
    But, The particle are not spawned at the player position
     

    Attached Files:

  2. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Elaborate
     
  3. Sandertv

    Sandertv Zombie Pigman Poggit Reviewer

    Messages:
    786
    GitHub:
    Sandertv
    I'm guessing you use a delayed task which stores the position of the player when stored, and then casts the particles at that position. You could pass the player variable to the constructor by reference if this is the case.
     
  4. Bintang Putra

    Bintang Putra Witch

    Messages:
    63
    GitHub:
    chaostixzix
    How do i do that?
     
  5. falk

    falk Slime Poggit Reviewer

    Messages:
    75
    GitHub:
    falkirks
    No, see lines 1-3. Line three seems to be messed up. It should be Z and not X.
     
    Palente, corytortoise and Sandertv like this.
  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.