Advanced Particle Algorithm

Discussion in 'Plugin Development' started by ski23, Jan 11, 2016.

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

    567legodude

    @ski23 That's what pitch, yaw, and roll mean.
    They are for x, y, and z rotation. You can rotate on all 3 axis.
     
  2. Offline

    ski23

    Let me play around with it.

    @567legodude I've been experimenting with it but, I'm not exactly sure how to get the roll value from a location. I did some reading about yaw pitch and roll but I still don't quite understand everything you are doing and your variable names are somewhat hard to follow. Right now, I have the circle rotating around the y in minecraft fairly well but when I change my pitch, the circle slowly develops into a straight line. Could I see the code you used in that video on how you got the roll value?
     
    Last edited: Jan 19, 2016
  3. Offline

    mcdorli

    You can't get roll, only yaw and pitch, I'm not even sure, ehy you need it.
     
  4. Offline

    ski23

    Thats what I understand from what I've been reading which is what has left me so utterly and helplessly clueless on how to use the code that he gave me
     
  5. Offline

    567legodude

    @ski23 The way I adapted the rotation matrix, yaw will rotate around the y, pitch rotates around the x, and roll rotates around the z. It is working fine around the y axis because that is the easiest to work with.
    I'll try my best to explain how to make it move with your pitch.

    If you simply change the pitch, it will rotate around the x axis. That's fine if you are parallel to the x axis.
    But if you are facing towards the x, then rotating along the x is useless and won't do anything.

    So when you are facing the x you need to rotate the z, when you are facing the z you need to rotate the x.
    Let me explain that so you are not confused.
    (In MC a yaw of 0 is towards positive z)
    Let's say y is the player's yaw and p is the pitch.
    In this example the pitch will be -30 (looking upward, in minecraft it's backwards)
    We want to change both the pitch and roll based on the yaw so that the shape is not distorted.
    Using that information, we get these equations.
    y = playerYaw
    p = playerPitch
    shapePitch = cos(y) * p
    shapeYaw = sin(y) * p
    You might need to multiply the pitch by -1 because of how MC does the pitch.

    It's really that simple. To get the pitch of the shape, take the cosine of the player's yaw and multiply it by their pitch.
    And for the shape yaw, use the sine of the player's yaw and multiply that by their pitch.
    If I happened to make a mistake in all this let me know, this is all from memory.
     
  6. Offline

    ski23

    @567legodude You say that I need to change both the pitch and yaw based on the roll. However, from what I have seen, you cannot get a roll value from a direction vector. I follow what you are saying but I dont quite follow how you are implementing the equations. When you test it, does it work without distortion while looking any direction up, down, or around the y? You say that the pitch is only good while parallel to the x axis and the roll is only good parallel to the z, so how do you make it not distorted in between? Thanks again for all the help you've given thus far.
     
  7. Offline

    ski23

  8. Offline

    ski23

Thread Status:
Not open for further replies.

Share This Page