Solved Shrinking Particle Circle

Discussion in 'Plugin Development' started by ollinator01, Dec 12, 2016.

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

    ollinator01

    Hey,
    anyone knows how i can display an circle that can spawn with specific radius and shrinks into the feed of the player.

    If i use this code:
    Code:
    t += Math.PI/16;
                        double x = 1.5*Math.sin(t);
                        double y = 0;
                        double z = 1.5*Math.cos(t);
     
  2. Hey.

    What do you mean by 'the feed of the player'?
     
  3. Offline

    Wispyy

    I think it starts big and slowly decreases as it moves to the center of the player. "Feed"
     
  4. Offline

    mythbusterma

    Sulphate likes this.
  5. Offline

    I Al Istannen

    @ollinator01
    Maybe dampening the radius in each iteration?
    Code:
    cos(theta) * Math.exp(-0.1 * time) * initialRadius
    -0.1 is some random value, you need to adjust it to fit your needs.
    We didn't have 'e' at school yet (next topic actually), but it seems like a shorthand for an exponential function for now.
    That will cause it to exponentially shrink (from 1 to nearly 0), so the schrinkage will get slower and slower.

    If you want a linear schrinkage, just subtract your desired linear function:
    Code:
    cos(theta) * initialRadius - 0.5 * time
    This will subtract "0.5" times the "time" from the radius, which lets it shrink by a constant amount per "time".
    You can change 0.5 to whatever you please, or substitute it for any equation.

    I think that will work, but I haven't tested it.
     
    ollinator01 likes this.
  6. I would explain how to do it not using sin and cos but eh whatever, I suppose it's not needed.
     
  7. Offline

    Tecno_Wizard

    @Sulphate, lol. Unless you like boxes, you've got to use some trig.
     
  8. Offline

    ollinator01

    Yep, @I Al Istannen it works fine!
    Thanks all of you for the help, have a nice day.
     
  9. @Tecno_Wizard I was gonna go down the path of the equation of a circle, but meh :p
     
  10. Offline

    mythbusterma

    @Sulphate

    The equations that describe a circle in Euclidean geometry are derived from Sine and Cosine, so I'm not sure what difference it makes. It's simpler to express it this way.
     
  11. Yeah I know I'm just stupid and excessively complicated ;)
     
Thread Status:
Not open for further replies.

Share This Page