Solved Spawn Line of Particles In Direction of Player

Discussion in 'Plugin Development' started by ReadySetPawn, Jan 25, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    ReadySetPawn

    So I want it so that when the method is called, a line of particles spawn in the direction the player is facing.
    I made a simple "grid" to help visualize the effect I want.

    http://tinypic.com/view.php?pic=1p6vig&s=8#.VMV3EPmnxk4

    X is the player's yaw. I want the hypotenuse to move it's end points accordingly with x.

    I have the particles down and everything. This is the only concept I need to figure out.
     
  2. Offline

    ColonelHedgehog

    Try something like this:

    Code:
    Location loc = player.getEyeLocation();
    double maxLength = 20;
    for(double d = 0; d <= maxLength; d += 0.1) 
    {
        loc.add(loc.getDirection().multiply(count));
        // Do particle stuff with loc.
    }
    
    Basically, you add the vector from the eye location director, and multiply its magnitude by "d." You can set a maximum length with "maxLength." (Kudos to @Skionz for the general idea)
     
    Skionz likes this.
  3. Offline

    ReadySetPawn

    Nevermind, I just didn't see the particles because the count was at 1.

    Thanks for the reply :)
     
    Last edited: Jan 25, 2015
Thread Status:
Not open for further replies.

Share This Page