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.
but when I change it's position, I want it to be able to rotate without any further action taken from my input devices
asked Aug 03 '16 at 11:54 AM in Blueprint Scripting
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
In BeginPlay we get the center position on the screen and find the radius for the circle (MaxMouseDistanceFromCenter).
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.
answered Aug 03 '16 at 01:21 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here