Rotate Valve with Mouse like in Amnesia

Hi there. I’m currently stuck at the mechanics for rotating a valve or wheel with the mouse. I want to make it like they did in Amnesia where the player has to mimic the rotation of the valve with the mouse. (“Drawing” circles clockwise or anticlockwise)

I have a setup that makes a direction out of mouse x and y and gets the rotation from it but that seems to work only on vertical mouse movement and gets jittery at horizontal mouse movement.

Does someone know how to do this properly or how they did it in Amnesia? Thanks in advance!

Hi man,
i remember that game , i am pretty sure that you were forced to make some movement, relative to the object center.
So i would say that the mouse alone is not enough , and you really need to detect if the circular move you are doing is really around the " rotable point".
so you should detect the mouse/touch on a plane of the rotation.
detect if you are moving in any direction, comparing the mouse/touch impact on the plane
And knowing the direction, checking if is clockwise or anticlock.
Then apply the rotation to the object if possible

Thanks for your infos. After some research I found out, that Amnesia does this with real physics, constrains and springs (I think we don’t have springs in UE). But using real physics like a physics handle is not an option since I have to detect how many full turns the valve does. I came up with a solition that centers the mouse cursor on interacting with the handle and then finds the look at rotation based on cursor position and viewport half-size. It’s not super elegant but it works since we don’t have a visible mouse cursor. Here is the Blueprint if anyone is interested. I leave the topic open. maybe someone has an even better solution to this since mine is just a hack :wink:

Edit: here is the link to the infos on how it works in Amnesia: http://www.codingser.iblogger.org/2017/04/22/amnesia-interactable-door-and-valve-physics/