Solved Rotate entities proportionately around center location

Discussion in 'Spigot Plugin Development' started by SeanTMG, Sep 23, 2020.

  1. I'm extremely bad at math, and I don't really know where to start here, so I'll just explain the issue.

    I have 3 Armor Stands set as sticks. I have a center location and a rotation, I need to rotate the armor stands around the center location while moving them to constantly be in a straight line (as depicted below)


    This is a straight line of 3 Armor Stand Sticks, what I need to achieve is this:


    Just setting the rotation would be easy, but you would end up with this:


    I just don't know how to calculate the locations of the outermost 2 Armor Stands, to line them up with the center one.

    EDIT: A friend helped solve it, for anyone wanting to know how,
    Code (Text):
    angleInRadians = angle * Math.PI / 180
    newX = sin(angleInRadians) * distanceFromCenter + centerX
    newZ = cos(angleInRadians) * distanceFromCenter + centerZ
    #1 SeanTMG, Sep 23, 2020
    Last edited: Sep 23, 2020