Proper location iteration. Possibly math related.

Discussion in 'Plugin Development' started by qlimax5000, Apr 15, 2014.

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

    qlimax5000

    Hello.
    I need to create particle effects in a straigt line. I already know how to display the particle effects (using packets) but using BlockIterator makes it not look very good when not looking in a straight line. I need it to work like this: [​IMG]
    As you can see, it goes in a perfect line.

    Thank you.
     
  2. Offline

    rfsantos1996

    Maybe a vector using target block and eye location?
     
  3. Offline

    LucasEmanuel

    Have you even tried using the search function? The amount of times I have personally answered this questions is way to high and I know others have done the same.
     
    Garris0n likes this.
  4. Offline

    xTrollxDudex

    qlimax5000
    Basic trig and location add methods. Doing something similar, haven't tested yet however.
     
  5. Offline

    qlimax5000

    LucasEmanuel
    Doing what i found in one of your other posts made it go per block, like from x0.0 to 1.0 but doing that vertically gives it some really hard corners.

    xTrollxDudex
    Great, if you figure it out could you come back at me?
     
  6. Offline

    blablubbabc

    qlimax5000 So something like this ?

    Code:java
    1.  
    2. void playEffectsInLineOfSight(Player player, double spacing, double distance) {
    3. Location nextLoc = player.getEyeLocation();
    4. Vector step = nextLoc.getDirection().normalize().multiply(spacing);
    5. double distanceLeft = distance;
    6. // this does not start directly in the players face but 1 step further
    7. while ((distanceLeft -= spacing) > 0.0D) {
    8. nextLoc.add(step);
    9. playEffectAt(nextLoc);
    10. }
    11. }
    12.  
    13. void playEffectAt(Location loc) {
    14. // put your effect creation code here
    15. }
    16.  
     
  7. Offline

    qlimax5000

Thread Status:
Not open for further replies.

Share This Page