Make entities circle around a few blocks over player's head

Discussion in 'Plugin Development' started by jimbo8, Mar 31, 2014.

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

    jimbo8

    Hi!

    I'm working on a helicopter plugin and i've got the flying done. What i need to do, is make entities or blocks circle around a few blocks over the player's head. Like this(showing with blocks):

    [​IMG]
    The blocks are supposed to be minecarts. Any ideas? Thanks :)

    Edit:

    I guess i have to use vectors in some way?
     
  2. Offline

    Maurdekye

    jimbo8 You need to use a bit of trig, with sin and cos.
     
  3. Offline

    jimbo8

    Maurdekye

    And how am I going to do that? :p
     
  4. Offline

    Maurdekye

    jimbo8 Well, a simple explanation is that if you take n, and multiply a vector's x coordinate by sin(n), and the y coordinate by cos(n), then the vector will rotate around (0, 0) by n degrees. You can use that to your advantage.
     
  5. Offline

    jimbo8

    Well, i'm terrible at math, so i need a headsup here :p

    No but seriously, i'm really, really bad at math. Got an example/snippet of a code so i know what i'm about to work with? I haven't really worked with sin and cos.
    Maurdekye
     
  6. Offline

    Windy Day

    No snippets from me. But here is an overview of sin and cos.

    x = cos(x)
    y = sin(x)

    if you enter this into a graphing calculator (while set to parametric function) it will output a circle in your graph. If you wish to change the size of the circle you must change the amplitude of the sin or cos function. This is done with a number placed in front of sin/cos. For example if you wanted the radius to be 5 you would enter.

    x = 5cos(x)
    y = 5sin(x)

    So knowing this you should be able to apply it to minecraft using x and z to draw circles.
     
Thread Status:
Not open for further replies.

Share This Page