Download

MouseXY for camera control without using RMB

Hi,

I have a blueprint set up to give camera control to the mouse. I’ve set up the “Project Settings > Input” to have “Mouse X” and “Mouse Y” axis mappings, and have put the input axis events in the controller blueprint and connected them to call my camera manager. But the values passed by the “InputAxis MouseX/Y” event “axis value” output pins are always 0 unless I have the right mouse button pressed, then the axis values start getting passed to my camera manager. Is this is a project/engine setting that reserves the mouse movements for moving the cursor (I’ve looked everywhere in project settings and blueprint mouse nodes) (p.s. my right mouse button is reserved for other input actions).

Any help would be great…

Thanks

Where are you getting your Axis values from? From the controller BP?

Hi,

Yep, from the event graph in my controller BP (parent class: Player Controller.h), from the “Axis Value” output pin of an “InputAxis [mydefined project input axis (set to MouseX/Y)]” input event node…

Can you post a screenshot of the event that should be giving you the values?

Please see attached image (the branch on Y is just a test catch to break as soon as a non-zero output is given - only breaks when right mouse button held down)…

Hmm. ok that should work depending what is happening with that event there… is that custom event in the same blueprint you just showed?
If not you will need a cast

As a test… if you print string the values directly from the inputaxis amouseX and y… do they still print zero?

Hi Crocopede,

Print stringed the InputAxix aMouseX/Y axis value output pins, they continuously output 0 until the RMB is pressed, then stream values between about +/- 0.05 to 0.14…

The “Mouse Move” custom event is in my camera manager blueprint, “Camera Manager 2” is a local variable (BP_MyCameraManager object reference) that I set at BeginPlay using the inherited “Player Controller > PlayerCameraManager”, then “Cast To BP_MyCameraManager”, then save the "As … " output pin to “Camera Manager 2” (just to save recasting every time)…

Hi Crocopede, Just spotted something. When I disable “MyController > Details > Mouse Interface > Show Mouse Cursor, and Enable Click Events”, It works (but only when both are disabled). But now it doesn’t show the mouse cursor, and it won’t pick up any umg widget button presses…

That is seriously weird. If its mapped to axis it should work and not require any other input. The fact that you need to click before it starts registering anything is a bit suspicious. I had similar issues in the past but that was because my event wasn’t firing on my controller. I tried recreating it but in mine it works fine.

Have you tried this is other projects?
This has to be something small we are missing…

Sorry, I should have said it works only when the RMB is held down, when RMB is released again, it stops working again (i.e. InputAxis event only outputs non-0 while the RMB is held down). At first I thought it must be a play in viewport pre-set that only allowed camera rotation when the RMB was down.

As it happens, I’m porting the whole project tomorrow/Monday as about to make a big change (changing the player controller from controlling a single character to interfacing with an AI controller to control multiple characters), I’ll try rebuilding the whole player controller blueprint (and project settings) from scratch and see if anything pops up…

Hi,

Ok, I’ve created a new project (blank blueprint project, then added a new empty player controller derived from base class), then just added the Mouse XY InputAxis events, and the same thing happens. Would there be any chance of promoting this to a UE4 developer as it’s kind of blocking progress, and I need to find a work around…

Summary:

  1. Created a new empty project, then a new empty player controller blueprint from base class.
  2. Added MouseX/Y InputAxis events to project settings, and added the InputAxis events to the player controller.
  3. Added a float not equal to zero branch (as image above).
  4. Found when “Player Controller > Details > Mouse Interface > Show Mouse Cursor”:
    i) enabled: LMB or RMB needs to be held down for non-zero values to be output from Axis event.
    ii) disabled: non-zero values output without mouse button held down.
  5. Same is also true for the “Input > Axis Values” get MouseX/Y nodes when triggered off event tick.

The problem is, I need to be able to have access to mouseXY values without LMB/RMB being held down.
I also need to be able to see the cursor.

If anyone has a work-around this would be great.

Hey man.
Sucks that you still struggling. I just quickly added a blank project to test. Its definitely working this side. All i have is input axis mapping…
516422c8697da8f2a9eef58f572a732d40d67ec1.png

I don’t even have a show mouse cursor event.
The only thing i did noticed is that 0 returns so often that it looks like its not giving anything other than 0.
I reckon your best bet is to go report this on answerhub under bugs if you are not getting anything other than 0

Hey Croco, just checked on AnswerHub, it’s a known issue and is somewhere on UE4s to do list. The work around is to use the “set show mouse cursor” node in the controller blueprint to set it dynamically according to need whenever you press your free-look input key, then “set input mode game only” to refocus the mouse to be in game…

https://answers.unrealengine.com/questions/133398/switching-show-mouse-cursor-from-on-to-off-loses-f.html

Thanks for your help…