Clamp Axis Value?

Hey there!

I implemented a 360 rotation in the X Axis around my game object (basicly like in the 3rd Person template but without a CharacterMovment Component).

The Z (Yaw) Axis works like a charm:

The Y Axis causes however problems:

The SpringArm rotates and spins like crazy when im 90 or -90 degree above/under my game object with my mouse y input.

I know i need to clamp it so that never tries to get higher than 90 degree or less than -90. The problem: When i use clamp angle it´s obviously not working, since my Value is the Axis one. Ive tried to use Clamp Float, Clamp axis etc. but everything seems not to be working properly.

Any ideas how i could clamp the rotation to 90/-90 for the SpringArm so that it never gets higher than those angles?
Again, im not using the CharacterMovement Component since the Object is not a Character.

Thanks in advance.

Create new Variable where you store axis value + current rotation on axis you want to move, check if it’s >=90 or <=-90. If it isn’t, set relative rotation on the axis to the value of variable you created.

How do i store the current rotation on the axis?

Did you mean to SetRelativeRotation, not AddRelativeRotation?

SetRelative would only set up the rotation to a value.

AddRelative adds to the current rotation a value.

Im using a SpringArm that i control with my mouseinput, so it already has a angle and needs add value to update it.

drag a connectoir from axis value and choose “promote to variable”

Yes, and if you keep adding rotation every time the axis value is updated, it will spin like crazy - which sounded like the problem you were describing. Perhaps I misunderstand your issue.

Not at all. Make Rot is limiting the axis, so its not possible that anything is spinning crazy when something is updated. The AddRelativeRotation adds the Input as a, well, rotation.

The problem was, quote:

The SpringArm rotates and spins like crazy when im 90 or -90 degree above/under my game object with my mouse y input.

Which indicates a problem in clamping. But again, thanks for trying to help.

Try This