Forum rules - please read before posting.

Invert Mouse X/Y

edited March 2023 in Technical Q&A

I'm looking to add the option to invert the mouse x + y in my game (point and click).

Was trying to do it through Re-Wired, but it appears I need to make a change somewhere in AC for this. I can invert using AC for first person though.

I found an old topic, which referenced making a change in PlayerInput.cs - https://adventurecreator.org/forum/discussion/2412/invert-mouse-axis

This is 8 years old though and the line no longer exists. Going over the PlayerInput.cs file I can't exactly see where it calculates the mouse position.

Any tips or places I should look for this?

Cheers.

Comments

  • To be clear: are you looking to use Rewired for this?

    AC input readings can be modified by assigning a delegate override to PlayerInput - see the Manual's "Remapping inputs" chapter for details.

    This approach is used by the Rewired integration found here:
    https://adventure-creator.fandom.com/wiki/Rewired_integration

    If you wanted to invert the CursorHorizontal / CursorVertical axes, it'd be a case of modifying that script's CustomGetAxis function with the following:

    public bool invertX, invertY;
    private float CustomGetAxis(string AxisName)
    {
        float value = player.GetAxis(AxisName);
        if ((AxisName == "CursorHorizontal" && invertX) || (AxisName == "CursorVertical" && invertY))
        {
            return -value;
        }
        return value;
    }
    
  • edited March 2023

    Hey Chris,

    Thanks for the reply.

    I was trying to use rewired for this, and it's fine for First Person KB/M or KB/Controller but not when using KB/Mouse Point and Click.

    I'll take a look at what you've provided in the morning and report back.

    Cheers,

    Andrew

  • Hey Chris, sorry for the late reply.

    Managed to get it running.

    Thanks for your help!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.