I’m learning UE4 by reading/watching tutorials. Right now, i’m working this tutorial series : [Twin Stick Shooter]
Everything works just fine, but i’d like to go a little further. My goal is to modify the controller to be able to move with the keyboard and rotate/fire with the mouse. I could manage it, but i have one last problem.
What i want to achieve :
- move with the keyboard (OK : was already like that in the tutorial)
- aim with the mouse (OK : i used [RayPlane Intersection Point], maybe there’s much better, but it works)
- shoot the weapon when i click the left mouse button (buggy)
- stop shooting when i release the left mouse button (OK)
- show a crosshair (buggy)
So, what is the problem : when i enable the crosshair (show the mouse cursor), i have to double click (and hold but that’s what i want) to fire the weapon, when i do not show the crosshair, weapon firing is working just as expected.
So, what i’ve done :
In my project settings, i added an action mapping called “Fire”, and mapped it to the left mouse button.
I created a new blueprint extending the PlayerController blueprint named MouseController and then taught the game mode blueprint (the one frome the tutorial : TwinStickMode) to use that controller by default.
And that’s all, when i leave the “Show Mouse Cursor” property unticked in my MouseController blueprint’s class defaults, everything works as expected, but i don’t see my crosshair, but when i turn the property on, i see my crosshair as expected, but i have to double click to fire the weapon.
I added some debugging nodes to my HeroCharacter blueprint to understand what happens here :
Now i can say that the Fire event gets called correctly when my mouse cursor is hidden (PRESS and RELEASE strings get displayed correctly), but when my mouse cursor is shown, the event doesn’t get called as i want, i have only one RELEASE string for a single click and i have two RELEASE strings and one PRESS string for a double click.
I’ve seen many questions about mouse problems, but couldn’t find anything similar enough to help me out, so any idea would be apprectiated.
Thanks for your time.