Shaped Particle Effects

Discussion in 'Plugin Development' started by 123ang, Aug 15, 2014.

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

    123ang

    Hey there, I've been trying all day to create particle effects that spawn in a really cool shape.

    I've only managed to make a circle, but it's kinda boring =/

    Code:

    Code:java
    1. if (cmd.getName().equalsIgnoreCase("circle")){
    2. playCircularEffect(((Player) sender).getLocation(), Effect.MOBSPAWNER_FLAMES, false);
    3.  
    4.  
    5. } return true;
    6.  
    7.  
    8. }
    9.  
    10. public void playCircularEffect(Location location, Effect effect, boolean v){
    11. for (int i = 0; i <= 8; i += ((!v && (i == 3)) ? 2 : 1))location.getWorld().playEffect(location, effect, i);
    12. }


    I really want a helix shape, like this one:

    [​IMG]

    I know that it'll be hard, but I hope I can find a way :D.

    Thanks for the help in advance :)!
     
  2. Offline

    _Filip

    Cant you just increase the radius of the circle and decrease the y on every iteration?
     
  3. Offline

    123ang

    @TheSpherret Okay, let me rephrase that; it looks nothing like a circle:​
    [​IMG]

    Anything? Anyone?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 9, 2016
  4. Offline

    Jaaakee224

  5. Offline

    xTigerRebornx

    123ang Playing the mobspawner effect through Bukkit will spawn a group of them, use a Particle Effect lib to spawn singular ones.
     
  6. Offline

    AoH_Ruthless

    123ang
    Your problem might be that effect. That effect tends to not follow any pathway and will disperse on it's own. Try using the same effect as your screenshot (redDust i believe is the name) and see what you get.
     
  7. Offline

    123ang

    xTigerRebornx I actually did this however, my playCircularEffect doesn't work with it =/, nor do I know how to make it work.

    AoH_Ruthless RedDust doesn't come with the CraftBukkit API. I have to use ParticleEffect Lib; which doesn't work with my playCircularEffect.

    Okay AoH_Ruthless xTigerRebornx TheSpherret I wasn't able to use ParticleEffect Lib in my circular shape, however, I did manage to change the effect to smoke; which is singular.

    [​IMG]

    Anyone?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 9, 2016
  8. Offline

    LCastr0

    First of all, don't bump, please. Second, use Particle Effect Lib. Third, you will have to use angles, sin and cos. This, to make a 2D circle, shouldn't be hard. Though, a 3D circle (like the one you showed), might be a bit hard.
     
  9. Offline

    Slikey

  10. Offline

    coco5843

    :0 really nice and great , good work
     
  11. Offline

    coco5843

  12. Offline

    LCastr0

    Thats a nice effect :)
     
  13. Offline

    Jaaakee224

    coco5843 Try that with the spark effect, I'd like to see that.
     
  14. Offline

    coco5843

    Rep. of NetGamers likes this.
  15. Offline

    Glass_Eater84

    coco5843 Im interested in the source... That with the shaders... O EM GEE
     
    mcaustin1 likes this.
  16. coco5843 The effect what you have created is great, can I get the source?
    I will make a PM to you
     
  17. Offline

    CentrumGuy

    I found out how to do it:

    Code:
    public static void runHelix(Location loc) {
       
            double radius = 5;
       
            for (double y = 5; y >= 0; y -= 0.007) {
                radius = y / 3;
                double x = radius * Math.cos(3 * y);
                double z = radius * Math.sin(3 * y);
           
                double y2 = 5 - y;
           
                Location loc2 = new Location(loc.getWorld(), loc.getX() + x, loc.getY() + y2, loc.getZ() + z);
                ParticleEffect.RED_DUST.display(loc2, 0, 0, 0, 0, 1);
            }
       
            for (double y = 5; y >= 0; y -= 0.007) {
                radius = y / 3;
                double x = -(radius * Math.cos(3 * y));
                double z = -(radius * Math.sin(3 * y));
           
                double y2 = 5 - y;
           
                Location loc2 = new Location(loc.getWorld(), loc.getX() + x, loc.getY() + y2, loc.getZ() + z);
                ParticleEffect.RED_DUST.display(loc2, 0, 0, 0, 0, 1);
            }
       
        }
    if you decrease y -= 0.007 there will be more particles and the particles will be closer together. If you increase y -= 0.007 then you will get less particles and they will be more spread out.

    *** Remember that you need to have the two particle effect classes. You can copy the code for these two classes from this thread: http://forums.bukkit.org/threads/lib-1-7-particleeffect-v1-5.154406/
     
    Jaaakee224 likes this.
Thread Status:
Not open for further replies.

Share This Page