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 5

(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

966 28 14 46

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 Dec 15 '18 at 11:41 AM

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.

avatar image ZZZZZION Dec 17 '18 at 03:36 PM

Hi, i had set a graph that similar to LordZedd's graph, but my character's view just do nothing and values from "print string" are correct. So are there any setting i need to set?

by the way, what i want to do,is to limit yaw but not in world rotation, can you give me some suggestion? Thank you.

those are my blueprint in character class event graph and some settings: alt text alt text alt text

and those are animation blueprint event graph: alt text alt text

捕获.png (191.3 kB)
捕获2.png (300.0 kB)
捕获3.png (13.7 kB)
捕获4.png (225.9 kB)
捕获5.png (109.5 kB)
avatar image ZZZZZION Dec 18 '18 at 11:56 AM

Well, I crest a new graph and it work, but still in world rotation, character can only face in one direction, I would like to make limited yaw in every direction.

Your had said “the relative rotation is relative to the parent component and if the parent is root, it will give you world rotation.” Am I need to edit in C++?

would you give me some suggestion? Thanks a lot.

avatar image navid100 Dec 18 '18 at 02:28 PM

character is one component, camera is another. First you must know what exactly u are gonna achieve. if 'use control rotation' check box is checked, your camera automatically read from mouse input (if mouse input is already set in project settings). By default it is checked. but for some rare situation you may want to uncheck it and manually set camera movement based on mouse X/Y input nodes. you don't need to go through c++ for doing what you need. The thing is first you must have a solid understanding of rotations and how they are implemented inside unreal engine. I have answered a similar question a while ago. check it it may be helpful.

avatar image ZZZZZION Dec 18 '18 at 03:10 PM

Thank you so much, about what actually want to do, i am no sure i can explain it clearly by words, so i make a video, hope that can help to explain what i want.


and the similar question you just post, i will have a look right now, also waiting your reply, thanks again.

avatar image ZZZZZION Dec 19 '18 at 02:34 PM

Well, this video can show what i actually want to explain more than the first video i just post. Hope this can be help.


avatar image navid100 Jan 12 '19 at 04:24 PM

Here is your answer with some delay. I was just within "one month don't answer any question of the year of my life !! "

Go to character BP and follow my steps:

1 - Follow this graph which controls the mouse input values. I noticed a strange behavior when unchecked all inherit control rotation check boxes from camera boom. I noticed 'get world rotation' gives nonsense values while 'get relative rotation' gives me world rotation values !! That's why you may get confused a little when see my graph. That is a bug i guess.

alt text

2 - select your camera boom and set the settings below:

alt text

3 - erase everything within movement input section of the character BP graph and replace it with mine:

alt text

4 - select 'class default' tab from the toolbar above and follow this picture:

alt text

Now you are all set. But a problem will rise when trying to limit camera boom rotation values. Which is, when your character tries to move backward (toward camera) he will enter an infinite loop. And that's totally understandable. I leave this problem for you to solve. But to give you a direction where to look for it, you may need to make some changes in the third picture.


capture2.png (10.2 kB)
capture3.png (222.0 kB)
capture4.png (20.6 kB)
capture1.png (1.0 MB)
(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