x

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 to limited camera yaw for character rotation?

Hello, are there any methods to deal with the problem: I want to limited my camera yaw for my character between -135 ~ 135

There are methods I had tried:

  1. “View yaw max and view min”. It is limit yaw of the world, not my character

  2. “Add relative rotation”. I had saw some people in answerhub used it, I used it with “inrange(float)”, but when value achieve 135 or -135, character can’t move anymore.

I had search information a few days but still can’t deal with it. It would thankful if someone can give me some suggestions, thank you.

Product Version: UE 4.20
Tags:
more ▼

asked Dec 16 '18 at 12:30 PM in Using UE4

avatar image

Grayand
1 2 5

avatar image M.FatihSaglam Dec 17 '18 at 05:51 AM

This is always working for me.

alt text

I don't know if you are adding rotation to PlayerController or PlayerPawn. But you get the idea.

asdasdasd.png (105.6 kB)
avatar image Grayand Dec 17 '18 at 06:26 AM

Oh great, thanks, I will try it.

avatar image Grayand Dec 17 '18 at 11:24 AM

Hi, can I see your “pawn” setting or component tab? Has anything I need to setting with the scene component, I am still search for it. Thanks. And my rotation is add in character class

avatar image M.FatihSaglam Dec 17 '18 at 12:56 PM

A character is basically a pawn. My "pawn" is not a normal pawn itself but a pawn that in a ChildActor.

Don't confuse yourself with "pawn" node. The way I show you for limiting RelativeRotations.

You can add/set RelativeRotation for your character's CapsuleComponent.

avatar image Grayand Dec 17 '18 at 01:20 PM

Got it, thanks a lot, but now the camera can’t move anymore, seems your method is focus on pawn rotation right? Actually I want to limit the camera view, So Is it possible to limit the “camera rotation(not world rotation)” in a similar way?

avatar image M.FatihSaglam Dec 17 '18 at 02:08 PM

You can rotate limited with this almost on everything. Actor, Pawn, Component etc.

If you want to rotate camera only, you can use same idea on Camera components as well. Or you can use SpringArm as parent of Camera and Add/Set RelativeRotation to SpringArm for 3rd person camera movement. You can search for that on Google. Very easy to implement.

avatar image Grayand Dec 17 '18 at 02:55 PM

Ok, I think I should search some information, thanks.

avatar image Grayand Dec 18 '18 at 03:26 AM

Hi, it’s me again. After research, I had made those graph, but the view just can’t move anymore, and values from “print string” are correct. am I missing something? And I had “aim off” graph, will the problem in there?

Those are some of my graph: Character class blueprint event graph alt text alt text alt text

animation blueprint event graph alt text

avatar image M.FatihSaglam Dec 18 '18 at 03:42 AM

I think you should delete EventTick's execution pin from AddRelativeRotation's for a start. If problem continues, you should create a new fresh character class and check if same Add/Set RelativeRotation is working well.

Note: Check if you get same results in PlayInEditor and StandaloneGame.

avatar image Grayand Dec 18 '18 at 03:48 AM

Yes, that make sense, I forgot to create a new class for test, I will try and see what I get, thanks.

avatar image Grayand Dec 18 '18 at 11:34 AM

hi, it is work in my new empty graph, but the limit rotation still in world rotation, it shows like the character can only face on one direction.

actually I want the limit yaw in every direction. I had tried other solution in a few days, but still no idea, would you give me some suggestion? Thanks.

avatar image M.FatihSaglam Dec 18 '18 at 01:47 PM

So you want to;

Rotate character with mouse and fix camera behind it?

Or

Rotate character with keyboard WASD and rotate camera with MouseX/Y?

I am not sure I understand what you want to achieve exactly. And are you sure Add/Set RelativeRotation causes WorldRotation? I didn't understand how this could happen either.

avatar image Grayand Dec 18 '18 at 02:57 PM

seems i have not explain clear enough, so i make a video to try to explain it, hope that can help.

https://youtu.be/szq_33TkuTY

avatar image M.FatihSaglam Dec 18 '18 at 05:03 PM

So you want to do first one; Locking the Camera on Character and limiting Character's rotation instead of Camera's.

I tried everything I can with AddYawInput or AddControllerYawInput. But I couldn't succeed. And then, I changed way of implementing.

Use VictoryPlugin by Rama and you will see how easy is this:

alt text

asdasdasdasd.png (120.9 kB)
avatar image Grayand Dec 19 '18 at 01:14 AM

Really thank you, i will try it once I back to my computer

avatar image M.FatihSaglam Dec 19 '18 at 08:12 AM

Btw that is implemented in Pawn/Character class, not in PlayerController.

avatar image Grayand Dec 19 '18 at 02:31 PM

Wow, it become more closer to what i want to implement.

But sorry for my mistake, i had not explain clear enough, the video shows what actually i want: https://youtu.be/NDWdLLlR-Xk

i will still trying to find a way to deal with it by myself before you help to give me some suggestion.

Still thanks to you.

avatar image M.FatihSaglam Dec 19 '18 at 05:14 PM

There's something wrong with your pawn. I have no idea what it could be. Mine is working fine.

You can download from my uasset from here DONE IN 4.21

Working proof is here

avatar image Grayand Dec 19 '18 at 11:56 PM

oh thanks, I will check it.

avatar image Grayand Dec 21 '18 at 01:41 PM

Hi, sorry for late, something wrong with my UE4.21, cost some times to fixed it.

the video i posted last time was a mistake, sorry again, and this is the video explain what i really want, if your feel worry about what the video said please talk me, and i will change.

https://youtu.be/wHMF00LL4mI

You might saw i change the limited into -135 ~ 135, its ok, it can be any values, it just used for test.

Actually your uasset file worked quite similar to my own pawn,

But what i actually want to implement is, i will try to explain by word: can the yaw limited base on aimoff set animation ?

Looking for your reply, thanks again.

avatar image M.FatihSaglam Dec 21 '18 at 05:26 PM

Man I really don't understand you. Isn't my "Working proof" video what you really want? I show you every way we can achieve on UE4. Please don't tell me you didn't notice I sent you a video on my comment before yours. :)

As much as I understand, you want to turn your character's body within a range of -135,135 and also, camera behind you fixed to character and turns -135,135 as well. Am I not right?

avatar image Grayand Dec 22 '18 at 01:14 AM

Hi, I did saw you video and asset, there are helpful. Thanks a lot.

But no, that’s not I really went.

Forgive me I have not explain clear enough before.

Now, I have a aimoff set animation on my character, I want to turn my aimoff set within a range of -135, 135., and if I change my direction, the range will base on new direction.

My new video should have show that: https://youtu.be/wHMF00LL4mI

avatar image M.FatihSaglam Dec 22 '18 at 07:35 AM

Add/Set SpringArm's RelativeRotation as you did adding to Character itself. This would cause turning effect seperatly from each other.

I cannot help you anymore. Because these are all I know to turning character. Maybe an Animator (Epic's Staff) can help you better.

avatar image Grayand Dec 22 '18 at 07:48 AM

It’s ok, you already gave me many helps, everything you taught me are helpful. Thanks for these days, luck to meet you.

avatar image M.FatihSaglam Dec 22 '18 at 09:26 AM

I am happy I could help at least a little.

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

2 answers: sort voted first

Did you tried to use custom PlayerCameraManager class? It contains such setttings for camera rotation limitations. But I'm not sure this is what you are looking for. Anyway, create PlayerCameraManager, specify rotation limits, and set this class to your PlayerController.

more ▼

answered Dec 16 '18 at 12:56 PM

avatar image

redbox
4.3k 82 20 104

avatar image Grayand Dec 16 '18 at 01:03 PM

Oh thanks, I think it is worth to try, i will check it.

avatar image Grayand Dec 17 '18 at 01:09 AM

Hi, I had check your method, it still only limit yaw in world rotation, but still thanks, and I had seen someone in answerhub said if take rotation graph into “custom player controller”, it can be limit yaw in pawn. Did you know something abou that?

avatar image redbox Dec 17 '18 at 06:39 AM

Pawn rotation uses controller's ControlRotation, so you can get it, set its limits by simple per component clamp, set. But this rotation is in world coordinates.

avatar image Grayand Dec 17 '18 at 11:20 AM

yep, I will check it, thank you so much

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

I solved it, if u needs help, message me!

more ▼

answered May 15 '19 at 06:09 PM

avatar image

HornokTibor
1 1 1

avatar image Grayand May 18 '19 at 03:45 AM

Oh, thank you! I had change my plan and do not need this function for now, but if you like, you can post it on this question, thanks again!

(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