How to setup mouse axis input relative to the character and not the world

Hi Everyone,

Not sure if the title is exactly what I’m after or not but I believe you maybe able to help me.

So I currently have a FPS setup, I’ve decided to add a rotate feature to the character when they are in no Gravity but the issue is while rotating the mouse inputs also change, like they don’t stay relative to the character. So if the character is on the ground moving the mouse up makes them look up and moving it right makes them look right and so on. But say I set the Roll of the character to 45 degrees moving the mouse Up makes them look right, moving it right makes them look down. Anyone have idea on how to fix this or assist me with it? I want it so moving the mouse up no matter the roll angle it makes the character look “up” from their perspective.

I’ll add a video of the issue and a BP of how I roll the character.

Hi,

You can simply use “GetInputMouseDelta” or “GetMousePosition” nodes instead of input nodes. First one will give you the delta position of your mouse cursor per frame and the later will give you the position of your cursor based on your viewport coordinate. Both are fixed to the viewport orientation so they are independent of your character world rotation. You probably will need to use a multiplier to adjust the movement rate. At the end you need to set your character mesh component local rotation. Read mouse x/deltax values to set yaw and mouse y/deltay values to set pitch. if you use the first node then you’d better to use “AddLocalRotation” node instead.

Update:

Make sure to uncheck “Use Pawn Control Rotation” checkbox inside FP camera details panel.

Hope it helps,
Regards,

Hi Navid,

I’ve tried to do it as you explained, but it seems to be I’m not competent of figuring it out. Are you able to assist me and add a BP of how it’s supposed to be setup please?

Thank you.

Sorry for late reply. I just updated the answer.
Regards,

It’s ok, better late then never. Either one, i’m doing it wrong or just doesn’t want to work out smoothly for me.
So i’ll type out what i’m after.
I want the camera to still rotate with the character as he rotates in 0G, and for the Pitch and Yaw to go off the characters rotation, if you get what I mean. It’s like imagine a plane, even though the plane is on an angle when you “Pull up” the plane still flies up from it’s nose no matter what angle.

Do I also have to change the initial InputAxis’s for this method to work correctly?

(This thing is turning out to be a real pain for me)

Also thank you for taking your time and assisting me, greatly appreciated.

you should also unpin the input axis for controllers too. Forgot to mention, since we are not going to work with controller rotations anyway.

Sorry for the late reply, thank you for your assistance in trying to solve this issue but sadly it still isn’t how I want it to work. Even with the ways you have shown me.

Weird. I have tried it and it worked just as expected.

Can you do me a favor? Can you show me a quick video of what it looks like ingame for you? and also the Script + character model? I would appreciate it a lot if you can.

So the issue I have with the way that you showed me is that the camera actually doesn’t stay on the same angle. Like if I look around i am able to completed flip the camera upside down while the body is still standing still, i’m able to make the camera roll to a 45 degree angle and etc instead of it being a solid 0 roll. Hope that kind of clears it up a little bit more, if you want a video of what I mean I can show you one, once I get home.

Hi,

Replace this setup with the first photo. Hope this is what you ask for

Also make sure to uncheck use controller rotation check boxes.

245894-capture2.png

Regards,