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"

Limit camera/object rotation

Hi, anybody knows how to set boundaries for pitch and yaw for mouse input? I want to control came after using set view target.

I was trying to use clamp and clamp angles with min and max values but that didnt work.

Thx for help. alt text

Product Version: UE 4.20
rotationlimit.jpg (193.1 kB)
more ▼

asked Dec 03 '18 at 12:45 PM in Blueprint Scripting

avatar image

11 2 2 6

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

there are several ways to approach this...

the issue you are having is in using the Add Relative Rotation. Even if you clamp the input float, it will still "add" to relative rotation.

The simplest way with your current setup would be to add the following to Tick > Get Relative Rotation > Clamp > Set Relative Rotation

more ▼

answered Dec 04 '18 at 01:36 AM

avatar image

1.1k 9 17 20

avatar image LordZedd_02 Dec 04 '18 at 06:30 PM

Hi, thanks for the answer, but i need to say that im a little bit confused. Im sending my current blueprint setup which is obviously wrong and i need guidance.

My main problem with Set Relative Rotation is that it points my camera to "random" direction.

alt text

avatar image aNorthStar Dec 05 '18 at 01:56 AM

I'd have thought this would work, but I'd just run it off Tick... snip the connector between Add and Set relative rotation and see if this works

BTW if your RT Camera component is a Spring Arm component... this may not work... Spring Arm components don't always work well with relative rotation because relative rotation is overridden by Use Pawn Control Rotation and (maybe) Inherit Pitch / Yaw / Roll. So let us know if it's a Spring Arm component and a different approach may be better

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

Hey, I have found almost perfect solution 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 just camera component but meaby in this case it should be attached to spring arm.

alt text

avatar image aNorthStar Dec 06 '18 at 01:08 AM

... the first thing I'd try is using Clamp (angle) instead of Clamp (float)...

avatar image LordZedd_02 Dec 06 '18 at 12:32 PM

There is no difference between angle and float my camera is still rotating to the right.

avatar image LordZedd_02 Dec 15 '18 at 12:22 PM

Solved! For correct values use print node connected to event tick to print out yaw/pitch values per frame. Then check on what range you get the proper result.

alt text

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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