Download

MMO Controls issue

I have a C++ project that I’ve been working on for a while now, but the time has come to get the proper user controls going. Before I write any code in C++, I want to pre-build them in Blueprints to make sure they do what I want.

The goal is to have World of Warcraft style controls, where you hold down the Right Mouse Button to enable mouselook, and to interact with items, with Left Mouse Button used for clicking the hotbar, and selecting other characters and objects.

My first step, getting Mouselook to enable on RMB, works. The problem I’m running into right now is that when I use the RMB, the camera seems to lock into a 180 degree swing. I can rotate halfway around the model, then it stops, and rotate back 180 degrees. (If I continue swinging back and forth, it will eventually change the start & end positions.) If I release the RMB and click it again, I can continue to rotate around, with that as the new starting point.

Now here’s the kicker: If, while RMB is pressed, I click the Left mouse button, then the camera-look works exactly the way I want, able to swing completely around the model as much as I want, until I release the RMB. Then, the problem shows up again.

There is nothing attached to the controls in the C++ code, other than the default Turn/LookUp functions that come with ACharacter. In Blueprints, the only things connected to LMB is a function to print if the button is pressed or not. RMB has the same print function, but includes Set Ignore Look Input, Is in Input Mode, Show Mouse, Enable Click Eventgs, and Enable Mouse Over Events, ticked or not depending on if the button is pressed or not.

I have no clue as to why the camera/boom is being limited in this way, or why pressing LMB fixes it. Of note: switching the LMB/RMB functions in Blueprints does not affect the issue, other than switching which buttons I have to press.

For the Visual people, Here are my blueprints:
61fff48e4ac9f014e078b7772de0853698d96b08.jpeg

Here’s a video demonstrating the issue:
https://youtube.com/watch?v=ZT2G3bopUys

It wasn’t until I saw this video (which records the mouse pointer as a separate object) that I noticed that the limiting factor seems to be the sides of the PIE window. Changing it’s shape seems to change how much I can rotate the camera when RClicking, and if I release the RMB at one of those limits, the mouse is at the edge of the play window. Still unsure of what is causing this, or how to fix it.

Odd.

Does it still happen when run as a standalone?

Currently can’t run stand-alone, but the problem persists in all PIE options, which is the only way I can run it right now. Standalone is generating an access violation that I’m currently tracking down. I’m guessing the same error is causing the Launch button to fail as well.

Okay, so I created a new game with 4.7, copied the controls blueprints, and built the game. This problem is still persisting in all forms of play, PIE or standalone.

Once again, the problem is when I’m holding down the RMB, it tracks where the mouse cursor is, and when it hits the sides of the window, it doesn’t pass that point. Pressing LMB while holding RMB down removes that limitation, but it returns if I release RMB. Near as I can tell, if there was a way to reset my mouse cursor’s position after recording the movement, it might work, but I can’t find a way to set the cursor’s position in my character blueprint. Of course, I’ll have to record and set the cursor’s location anyways so the cursor shows up at the same location after releasing RMB, so I’ll need to find a way to set the mouse’s position even if that doesn’t fix my issue.

I’m gonna have to fix this this in c++, aren’t I? Any advice on how exactly to do that? I haven’t had much time to dig into the code of UE, so I’m mostly guessing with my c++ code, based on what I’ve seen others achieve and share.

Kjasi, below is how I accomplished it. Basically by setting the mouse to invisible, you no longer can hit the edges and everything works.

Edit: below is a picture showing how I accomplished what you wanted. Granted this is in 4.5.

1c5671d4d13d484006b9ae7bcb52285f27fe03e8.png

That is awesome! I got it to work! I was missing that add controller input part.

Thank you!

No problem, glad to help.

I have the same problem… The thing is, when trying to duplicate this solution, I found for some reason I can’t add the “add controller yaw/pitch input” node.
I’m using 4.92…
Also, my “set show mouse cursor”, “set enable click/mouse over” nodes don’t have a “target” input.
Any ideas as to what I’m doing wrong?

I found what I did wrong… I had the player controller blueprint open, not the character blueprint.
Still there’s one thing that doesn’t work as it should:

When I release the right mouse button, I have to click the LEFT mouse button to actually get the cursor visible again…
So I could still use some help …

Is there a way to refresh the cursor after being Set to be Visible?

I haven’t found a refresh or update option… Funny thing is that the first time I release the RMB, it works as it should…
Only after the second time the cursos stays hidden until I klick…

oké, I found the problem… “Set input mode Game and UI” has an option “hide cursor during capture”… Unchecked that (was default checked) and now it works :smiley:
Next issue is how to center the mouse after releasing RMB, but that’s a different issue.