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"

Mouse Rotation

Hi there! I was wondering how should I procede in a game where I want to continuously rotate the pitch and yaw based on my mouse location. So basically i want to have a non conflict zone where if the cursor is in middle where nothing should happen.alt text

but when I change it's position, I want it to be able to rotate without any further action taken from my input devicesalt text

Product Version: UE 4.12
help.png (13.6 kB)
help.png (28.2 kB)
more ▼

asked Aug 03 '16 at 11:54 AM in Blueprint Scripting

avatar image

16 5 4 6

avatar image Isadora Aug 03 '16 at 12:24 PM

Is there a way to calculate the distance between the center and the mouse cursor? Or anything that might help?

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

1 answer: sort voted first

Hey, I guess you want to do something like freelancer, right? In that case I got something for you:


The first image shows you what the following BP will do. It takes a circle around the mouse cursor and maps every mouse location to it. Closer to the center, Output will be X=0, Y=0. Mouse Right side of circle X=1, Y=0 | Mouse left side X=-1, Y=0. Get close to the top of the circle, Output will be X=0, Y=-1; | bottom X=0, Y=1 Every value in between is normalized


BeginPlay In BeginPlay we get the center position on the screen and find the radius for the circle (MaxMouseDistanceFromCenter).

Tick Here in Tick, we calculate a vector from the center of the screen to the mouse location. Check the length of it and divide the length by the radius of the circle to get it mapped to values between 0 and 1. All you have to to do is use the X and Y output and use it as you would with normal mouse or controller input.

Hope this help, I am here for any problems you might encounter.

circle.png (3.7 MB)
beginplay.png (99.2 kB)
tick.png (148.2 kB)
more ▼

answered Aug 03 '16 at 01:21 PM

avatar image

1k 30 8 45

avatar image Isadora Aug 03 '16 at 03:17 PM

Pardon me for asking this: would be this the right way to do it or I should advance further in research? To be honest it's odd a little bit.alt text

Sorry for my incompetence but I just barely start working in Unreal.

help.png (193.1 kB)
avatar image DennyR Aug 03 '16 at 03:31 PM

Just plug the output into MakeRotator X and Y directly every tick. No need for InputAxis stuff. X and Y of the normalized output are a replacement for InputAxis LookUp and LookRight.

avatar image Isadora Aug 16 '16 at 06:06 AM

DennyR I just hit a problem with the mouse cursor you helped me implemented. When I enter launch the script stop working. I guess I have to do something but i don't know really what. Can you give me a hand?

avatar image Isadora Aug 03 '16 at 03:59 PM

Thanks a lot for your support! Now I can move to the next step.

(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