Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Is it possible to limit the x rotation

Discussion in 'Visual Scripting' started by CornMonk, Aug 29, 2022.

  1. CornMonk

    CornMonk

    Joined:
    Jan 20, 2022
    Posts:
    3
    upload_2022-8-29_14-45-5.png
    I tried clamping it and it wont work and so don't other methods. if it is a simple fix i would appreciate that
     
  2. Trindenberg

    Trindenberg

    Joined:
    Dec 3, 2017
    Posts:
    395
    You are rotating every frame, limiting only the max amount of rotation. You can remove the clamp above. To clamp the rotation, you need to check the current rotation, then only rotate if it is inside the limit. If Transform.Rotation.eulerAngles.x, greater than -90 less than 90 => rotate