I am trying to make my turret barrel move up and down depending on if the mouse is pointing up or down. I want it to only rotate at the yellow point and not go past the green lines.
Please use the Search tool before posting items like this.
1 Like
You can use math.clamp to stop the angle from going outside of your range.
It would look something like this:
math.clamp(angle, minAngle, maxAngle)
If the angle is bigger than the maxAngle, it’ll return maxAngle, if it’s smaller than minAngle, it’ll return minAngle but if it’s between both of them it’ll just return the angle.
1 Like