Helix particle effect for projectile

Discussion in 'Plugin Development' started by AKZOBIE74, Nov 2, 2014.

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

    AKZOBIE74

    Ok so i how do i make it so when the player shoots the snowball projectile it shoots it out with a spinning helix effect? Please show me some code for the helix effect
     
  2. Offline

    AKZOBIE74

    Assist im not sure if what i want is called a helix but i want 2 short line of particles next to each other and they are spinning to the right while moving forward i dont know how to do this.

    Assist its like the helix but its not connected

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

    Skionz

  4. Offline

    AKZOBIE74

    Skionz ya but you see how its connected? Can you make them so they are 2 seperate lines still going in the helix formation?
     
  5. Offline

    Monkeyboystein

    When posting on the forums, try to refrain from saying "Please show me some code", You could go in depth with the problem, and then get replies with a way of doing it, first you should try to sort out the problem with the persons way of doing it and no example code yet, and if you still cant do it ask them for example code, you dont really learn as much with examples, you need to toy with it break things and fix them to learn the most.
     
  6. Offline

    AKZOBIE74

  7. Offline

    Monkeyboystein

    Im not the best at this, but in my opinion, use the helix 3d resource that you were linked to above, but change it so instead of going up the Y axis, it moves around the X or the Z, and spawn 2 of them with different starting locations so they spiral around but dont connect,
     
  8. Offline

    fireblast709

    AKZOBIE74 basically, it's just two circles (where one starts with pi as the angle, and one starts at 0), that increases in y every time you render a particle.
     
  9. Offline

    Monkeyboystein

    to get the helix to travel accross the x axis switch this line
    Code:
    PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("fireworksSpark", (float) (loc.getX() + x), (float) (loc.getY() + y ), (float) (loc.getZ() + z), 0, 0, 0, 0, 1);
    with this line

    Code:
    PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("fireworksSpark", (float) (loc.getX() + y), (float) (loc.getY() + x ), (float) (loc.getZ() + z), 0, 0, 0, 0, 1);
    I switched the y variable with the x variable and it travels across the x axis,
     
  10. Offline

    AKZOBIE74

    Monkeyboystein here take a look at this image you will know what i mean when i say i don't want them connected i edited this image i drew a black line in the middle of the helix to show you what i mean. Also it doesn't get the players eye location it just shoots its it in one direction.Could it also be smaller?Why dpesnt it get the players eye location and shoot it where the player is looking at?I made loc equal to player.getEyeLocation();

    http://s13.postimg.org/u9ufwuf13/2014_11_02_11_29_461.png
     
  11. Offline

    AKZOBIE74

  12. Offline

    Skionz

    AKZOBIE74 This is complicated. getEyeLocation() just returns the Location of the players eye not the actual direction the player is looking towards (well it does your just using it wrong)
     
  13. Offline

    AKZOBIE74

    Skionz could you help me?
     
  14. Offline

    ChipDev

    Use effectLib's DNA, and then set the strands to 0
     
  15. Offline

    AKZOBIE74

    Ok so i found the video that can show you what i want. I want the particle effect just like the one in the video. Skip to
    0: 20 seconds for the effect.

     
  16. Offline

    ChipDev

    Oh Skionz , Jeez you should know this puesdo :p.

    Make a helix effect,
    Then make a separate one starting 5 blocks higher, then -5 Y when you are spawning the particle (You do this to let the cosine/sin get a different value)
     
  17. Offline

    Skionz

    ChipDev Didn't I make a fake firework like that haha
     
  18. Offline

    AKZOBIE74

  19. Offline

    Skionz

    AKZOBIE74 Look at my tutorial and create two helix's going in opposite directions
     
  20. Offline

    AKZOBIE74

    Skionz The fake firework one?
     
  21. Offline

    Skionz

  22. Offline

    AKZOBIE74

    Skionz Could you give me an example i never created effects and i dont know sine's and cos
     
  23. Offline

    ChipDev

    Ok let me show you!
    Do you want to create this? just asking..
    [​IMG]
    Skionz of course, adding 7 to Y and then decreasing Y by 7 when spawning them!
     
  24. Offline

    Skionz

    ChipDev That works :p You can just change the x to negative
     
  25. Offline

    AKZOBIE74

    ChipDev Yes and how do i make it so it doesn't spawn on the player and how do i make that effect?
     
  26. Offline

    ChipDev

    Easy!
    Don't TLDR please, if you read carefully, you will LEARN.
    *Remember to thank DarkBladee12 !
    First, go look at my friend Skionz 's tutorial of helixes.
    Then create this runnable and variables in your OnEnable
    Code:java
    1. public static Double newloc;
    2. //Method to be acessed by other classes/Other methods/ this method.
    3. public void onEnable() {
    4. Double timestrand1 = world.getBlockAt(loc).getY();
    5. Double timestrand2 = world.getBlockAt(loc).getY() + 3;
    6. //Times (Fancy strand creating!), which we will add to on the runnable!
    7. Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
    8. //Create a runnable! yay!
    9. @Override
    10. public void run() {
    11. timestrand1+=0.2;
    12. //Adding to the strand number Y, :D
    13. if(timestrand1 >= world.getBlockAt(loc).getY(); + 20.0) {
    14. //Strand goes up 20 blocks
    15. timestrand1 = world.getBlockAt(loc).getY();
    16. }
    17. Double xcos = Math.cos(timestrand1) * 0.5;
    18. Double zcos = Math.sin(timestrand1) * 0.5;
    19. //Some cosine and sine things- Im bad with varible names, so the ZSin is named ZCos :p
    20. main.newloc = new Location(world, world.getBlockAt(loc).getX() + xcos, timestrand1, world.getBlockAt(loc).getZ() + zcos);
    21. //Cool! This is our new location, thanks to [USER=90749545]DarkBladee12[/USER] for this lib.
    22. ParticleEffect.FIREWORKS_SPARK.display((float)0, (float)0, (float)0,(float) 0.0, 1, newloc, 50);
    23. timestrand2+=0.2;
    24. if(timestrand2 >= world.getBlockAt(loc).getY() + 3 + 20) {
    25. //Strand goes up 20 blocks (well, 23.. but starts off 3 off the ground. We will subtract it when displaying!)
    26. timestrand2 = world.getBlockAt(loc).getY() + 3;
    27. }
    28. Double xcos2 = Math.cos(timestrand2) * 0.5;
    29. Double zcos2 = Math.sin(timestrand2) * 0.5;
    30. //Oh and yes, the *0.5 is the raidus, change that to whatever, but be careful... It gets very large over 1-2!
    31. main.newloc = new Location(world, world.getBlockAt(loc).getX() + xcos2, timestrand2 - 3, world.getBlockAt(loc).getZ() + zcos2);
    32. //Good!
    33. ParticleEffect.FIREWORKS_SPARK.display((float)0, (float)0, (float)0,(float) 0.0, 1, newloc, 50);
    34. }
    35. },(long) 0, (long)0.1);
    36. }

    It looks like spoon feeding, but... well.. comments :p
     
  27. Offline

    AKZOBIE74

    ChipDev I want it as a method because i want to implement it into my spells plugin how would i do that?
     
  28. Offline

    ChipDev

    AKZOBIE74 Do you have a onEnable class? (MAIN CLASS)?
     
  29. Offline

    Skionz

    AKZOBIE74 If you don't know how to make a method you should probably go look at a few starter java tutorials
     
Thread Status:
Not open for further replies.

Share This Page