[Possibly Solved] Moving player's head in an infinity shape (∞)

Discussion in 'Plugin Development' started by 5chris100, Jun 24, 2014.

?

Would I have to use Bukkit's scheduler to set the time for the cycle?

  1. Yes, you must!

    83.3%
  2. No, you don't have to.

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

    5chris100

    Hiya, devs! :) I'm creating a PvP plugin, and one of the effects the player will get is a "stunned" effect, which is basically the nausea potion effect combined with a head yaw and pitch change in the shape of an infinity symbol (). I'd like the head to follow the pattern of the symbol by changing the yaw and pitch, starting in the centre and going upwards and to the left, then down, then upwards and to the right, then down again, and repeating a set amount of times. How would I do this with a delay, so it takes about 3 seconds per cycle?

    Thank you to anyone that contributes! :)

    EDIT: Good job to all the smart people in the poll. ;)
     
  2. Offline

    chasechocolate

    I assume you know the other necessary checks (how to loop through a list of locations, schedulers, making them so they can't move when stunned, etc.)

    The graph for a lemniscate, in rectangular coordinates is:
    (x^2 + y^2)^2 = a^2(x^2 - y^2), where a is the radius.

    Here's some further info: http://mathworld.wolfram.com/Lemniscate.html
     
    5chris100 likes this.
  3. Offline

    RawCode

    and what you already did self in order to implement feature you described?
     
    5chris100 likes this.
  4. Offline

    Plo124

    chasechocolate
    Wow there, too much for me.

    Why should you need to work out both sides of the equation in Java, this would use more CPU
     
    5chris100 likes this.
  5. Offline

    5chris100

    Yep, already have that set up.
    Thanks, I'll try this tomorrow and see how it goes.

    What?

    That's true, it does look like it's not that optimized. I'll check the CPU usage before, during, and after the execution and get back to you.
     
  6. Offline

    chasechocolate

    Plo124 true, it'd probably be better to convert it to polar and use vector addition.
     
    5chris100 likes this.
Thread Status:
Not open for further replies.

Share This Page