Was moveX in BarrelRotation unnecessary?

posted to: Rotating Turret

I was curious about the moveX, moveY in the Quaternion.Euler in BarrelRotation and so I went to see what would happen if I took moveX and everything was fine.

Just curious if it was unnecessary or not.

Got the idea when I looked in the TurrentBarrels rotation info and with moveX there no motion at all in the y rotation(where moveX controlled the y axis)

  • Jonathan Gonzalez(jgonzalez) replied

    If you remove the moveX to read as such:

    Quaternion.Euler(0,0,moveY);

    The barrels won't rotate in the Y axis. If it's working for you just fine then you can leave it out. With the turret included in the project files the barrels will stay in place and can be rotated up and down but they won't rotate with the base along the Y axis. 

    Another thing that can be done is to utilize its original rotation for the Y axis. The first method, BaseRotation rotates the entire base along with the barrels along the Y axis. So instead of using moveX for the Y rotation of the barrels you can say:

    Quaternion.Euler(0,turretBarrels.eulerAngles.y,moveY);

    It's a slightly different way of writing it out, but useful if you wanted to rotate along one specific axis but keep the original rotation values for the other axis. In this case it wouldn't make much of a difference between using that or moveX in it's place. 

    If you have something different that is working I'd like to know what you did.