How can I rotate an object on mouse click?

Hello, I’m new to Unreal Engine 4, and was wondering, how I can first of all, stop the automatic mouse rotation around the scene. Then, when the cursor is pressed on the object and dragged, it results in the rotation of the object. Something like this for example: ‪Molecule Shapes‬

Well’p i don’t have all the answers at the moment but take a look at the Enable Input and Disable Output nodes. You can use those to enable and disable ALL input Or if you take a look at the FirstPerson template,in the actual FirstPerson blueprint,there’s a bunch of “add input” nodes all over the place for stuff like wasd keyboard input and mouse input. If you wanna disable just the mouse input then you can do something like this. Make a new Variable,Make it a Boolean. And then make a simple test for it. Something like uhh if left mouse button is being held down then SET the new Boolean that you made to false. Or true. And if the mouse button is released then SET the new Boolean to the opposite of what you set it previously(so set it to false,if it was set to true and set it to true if it was set to false)

The line leading in to the Sequence is coming from an Event Tick node(which pretty much makes sure it fires constantly no matter what. And also in my case im checking if Left mouse button And E are being held down. If they are then the input for the mouse is well,its not being disabled,its just not executing,or running. For your player to move and mouse to rotate your view,the input nodes MUST either be constantly running OR in most cases,only run when they are being triggered. So in this case the add Input Node for the Pitch and Yaw of the mouse is only being triggered(constantly,due to the Input AxisTurn is firing constantly) IF E is NOT being held down.

(One more thing to note. Im checking if left shift and E is being held down using branches. Instead of two branches you could use an AND Boolean. it does the same thing. If A AND B is true then it sets it to true,if one of em is false,then it sets it to false)

And as for mouse Rotation well i can point ya in the right direction. Mouse/Stick input pretty much work on mouse Acceleration(it could be mouse velocity,i don’t actually know lol) So that means the mouse X/Y or mouse Input events(the axis pin) will only output the Velocity of the mouse. So if you move it it will only output the speed. It doesn’t accumulate.

If you wanna control the rate,simply do this. get the Axis Value and Multiply it by a float Variable(in this case its the base look up rate,which is set to 45) and Multiply it by the World Delta Seconds.

This is fine untill you need a number that doesn’t constantly reset to 0 once you stop moving.
For that you wanna accumulate the Mouse X or Y.

The two screenshots i posted above are taken directly from a project im working on. But this next one i ripped apart to show you how you can accumulate an axis value. So if you were to follow one of these pics Step by Step its this one.

It pretty much works as follows. The Mouse X event constantly fires. That’s being split off in to two Branch nodes using a Sequencer. The arguments for the branch node for the Increment part simply checks IF the Mouse X is Greater than OR equal to 0.1 (This number can be changed for sensitivity). So if Axis Value >= 0.1 then ++(this means increment) Increment what? the Yaw++ Float Variable that’s being set AFTER the ++ node. If you hook up the Yaw++ variable as a getter to the ++ it will prettmuch increment itself. Set itself to that value. And +1 again and again and again till your mouse X is less than 0.1

For the decrement part we pretty much do the same except we change it up so If Axis Value <= -0.1 then --(decrement) Yaw-- till the mouse X is greater than 0.

This creates a gap(or a deadzone) between -0.1 and 0.1 So that means if you’re not moving your mouse,then its at 0. Meaning it wont increment nor decrement.

That’s pretty much it. Here’s some extra stuff that will help.

[Unreal Engine 4 - Zoom & Rotate Object - YouTube][4]

Again,this is long and as detailed as i can make it at the moment but dont take EVERYTHING i said as a step by step instruction manual. I’ve mostly ripped out some screenshots of a project im working on Without altering all of it except for the last screenshot. But this will get you pointed in the right direction.

Goodluck.

Thank you very much!