The problem is this: I want to be able to manipulate the camera action with the default mouse movements but also be able to make mouse onclick actions to interact with objects. I am also trying to maintain the cursor locked to the center of view. I have enabled click events so I can now trigger events but then the cursor won’t lock to the center of view. So when trying to click on an object the player has to unnaturally motion away from the object, and when you get the cursor in position and click the object, you then have to hold a mouse button to start moving again. So to lock the view I add “Set input mode game and UI”. The overall action is correct, but now to move I have to hold a mouse button down. I don’t want that.
What I want is free movement without holding a mouse button, lock the cursor position to the center, and have click events to trigger actions. Any help is appreciated.
Thanks for the reply. I’m not able to find anything about check trace. Do you mean Line Trace? And would I replace the “Set input mode game and UI” with Line Trace? Is there a tutorial you can point me at for this? To be clear, I want to do the following:
allow the player to look up/down/around freely with the mouse without holding a mouse button
lock the cursor position at the center (crosshairs)
This would be ideal for your situation. So what you would want is to have a Line Trace when the ‘onclick’ event occurs. What this does is it shoots a trace from your character outward from the center of your screen and returns a large struct of information about anything the trace hits.
But in your case you want to interact with objects. So instead of using the location of the hit actor, you’ll want different information from the hit result.
Here’s an example of using Line Trace by channel to interact with objects:
Here, you calculate the trace. It starts from your character to a given distance.
And finally, in your character bp you have the event ‘onclick’ set up like this. You can then work out how you want to interact with the object now that you know you’re looking straight at one.
Forgive me but that seems like a complicated solution. I appreciate your efforts and I will review all the material you provided, but I feel like I’m looking for a simple way to reverse this particular action. Everything is working as I intend except I have to hold the mouse button to look around when I prefer I didn’t have to. This is what I have: press play, look around, see door, press w to move to door, click on door and door opens. That all works except the looking around requires holding the mouse button.
Again, really appreciate the help and I’ll try out this approach.
Update:
I followed this - YouTube which has really helped explain what you are suggesting. I think this is what I’m after. With this I should be able to use the line trace to interact with various blueprint actors.