Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How limit spring arm pitch during rotation?

I tried clamping the variables, but the blueprint freaks out when I clamp the float variables. Anyone got any Ideas on how to limit the Pitch in this Blueprint.alt text

Product Version: UE 4.16
rotation.jpg (120.9 kB)
more ▼

asked Jun 18 '17 at 11:15 AM in Blueprint Scripting

avatar image

5 1 2 4

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first


1) What exactly do you mean by limiting? If you want to limit the total relative rotation, here is your answer;

You should use clamp nodes after adding rotation and before setting rotation node. Take a look at this simple setup for a better understanding;

alt text

2) If you want to limit the rotation rate, then you can divide the 'Can Turn Rate' variable or the axis value itself by 2 (or whatever number you like) then plug it into the multiplier node. And if you want to limit the rotation rate to remain in a specific value range, then plug axis value to a clamp node, then plug the clamp into the multiplier.

Hope this help.


event graph.png (402.2 kB)
more ▼

answered Jun 18 '17 at 12:39 PM

avatar image

911 27 11 45

avatar image Keal27 Jun 18 '17 at 01:44 PM

Thank you, that worked perfect! I have a question for you though? What is the purpose of adding the rotation and then setting it like this? Also Why do we break the rotation up with the break rotator like this? Sorry for the questions im just trying to learn as much as possible.

avatar image navid100 Jun 18 '17 at 01:55 PM

Because when you use 'add rotation node', you have no control over the total rotation. It just receives a delta value to add to the current rotation per execution. So in order to clamp the total rotation, you need to use 'set relative rotation' node to control the total rotation. Breaking the rotator, grants you access to each rotation axis value (X, Y and Z rotators). In this case you can clamp rotation over each axis separately.

avatar image Keal27 Jun 18 '17 at 01:59 PM

Thank you for the explanation.

avatar image navid100 Jun 18 '17 at 02:01 PM

You'r welcome

avatar image LordZedd_02 Dec 04 '18 at 09:01 PM

Hi, im trying to achieve similar effect but I cant get this thing work.

Im trying to add mouse movement to camera and than limit the yaw and pitch to certain degree. Byt when im adding "set relative rotation" node my camera rotate to undesirable place and I cant move camera.

thx for help

alt text

avatar image navid100 Dec 05 '18 at 08:05 AM


Because u r doing it wrong. u should use get relative rotation instead of world rotation. getting world and set it as relative doesn't make sense. You should do your math either in world space or relative space. You should also plug the 'get relative rotation' X and Z into the set relative rotation node. at the moment u are hard coding roll and yaw rotation values to 0. One more thing, you probably should work with spring arm rather than camera itself unless it's an fp camera otherwise you won't get correct results based on my exp.


avatar image LordZedd_02 Dec 05 '18 at 01:35 PM

Thanks for replay at such a short notice.

Yours solution is almost perfect but it works only with Y (Pitch) when im trying to clamp Z my camera is turning 45 degree however clamping is working on both values Y and Z. When im limiting only Y and pluging Z straight from rotator to relative rotation everything is perfect so the problem is somewhere in Z space.

Its FP camera but im changing it using "view target with blend" so I can try attach it to spring arm if you thing that would help.

alt text

avatar image navid100 Dec 08 '18 at 06:46 PM

not sure if i understood u correctly; first use print node connected to event tick to print out yaw values per frame. then check on what range u get the proper result (it may not be between -10 and 10 necessarily). after finding your proper range for yaw input, use that range. one thing to note is that the relative rotation is relative to the parent component and if the parent is root, it will give you world rotation.

avatar image LordZedd_02 yesterday

Ha it works! Thanks man, since you are an expert in limiting rotation I have one more question.

This time i would like to limit rotation in my character blueprint. I was trying to use "view pitch max/min" function and it kind of works. It is limiting my ability to look around but again my camera jumps to a random degree.

Im trying to add this limit to my character ability to lean left or right.

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question