Rotate Object with Mouse

Hey everyone!

I’m relatively new to Unreal, and I’ve been working on a project where I have a stationary camera that looks at an object. I’m trying to figure out how to drag on the object with the mouse so that I can rotate the object. I’ve been following a few posts on AnswersHub, and I posted the question to the community there, but with no response. Wondering if anyone here knows of a good tutorial for doing this or can give me some guidance.

My post on AnswersHub - Rotate Object using Mouse Input

Some of the other posts that I’ve been following:
Rotate Object Using MMB
Rotate Objects Using Mouse

Any help would be greatly appreciated. Thanks!

Funnily enough one of your reference posts was mine, sadly i don’t have anymore help with that blueprint as it was quite a while ago, however, i just put this example together which you might find useful.

The “editor Cube” being your object you wish to rotate.

Only thing is when using “mouse y” or “mouse x” in a BP it appears that the character can no longer use it which is odd, if anyone can chime in on that, that’l be great.
I hope this is atleast slightly useful.

2 Likes

that is correct behavior as any bp consume a input, other object down the input event hierarchy can’t use it anymore.

Can you explain the alternative?

Awesome! Thanks so much for the help. I’m going to try it out and see if I can get it working. Wish me luck!

It’s in the official document.

The best thing you can do is don’t use direct input events, always map your input in project settings.
And then use custom events to drive any actions when you received input events in your playercontroller bp if you want to have conditions for which one to accept events.
There is also a “Consume Input” checkbox on all input events(even the binding ones), if you uncheck then it allow lower priority objects(in the chart from the link above) to also handle those events.
But this is not recommended as you might create some logic hole that have infinite event calling and never really consume the event.

So yeah, just remember that inputs are and should be consumed for one, or in special case a set of limited objects.
you want to drive event in OP’s case, when LMB pressed and something is you can control, you enable it’s input and naturally your pawn will lose ability to turn camera.(as pawn is the bottom of input priority).
when you release then you disable input from the object.

sounds simple right? but preferably doing all this from playercontroller, and just issue event to either turn or rotate is simpler.

So if I was to use this to rotate an object by 90 degrees when i pressed a button in the world, how would i change this or should i be looking somewhere else for that?