Forum rules - please read before posting.

First Person Camera Invert X/Y

As title says, I'm looking for the line of code that will allow me to *-1 to it so it inverts in first person camera mode.

Been looking for a while now, and cant seem to find the actual line(s).

Thanks

Comments

  • It's in FirstPersonControlPlayer in PlayerMovement.

    It'll probably be easier to invert the CursorHorizontal / CursorVertical inputs in the Input Manager.  Inverting the camera sensitivity may also do the trick.
  • edited August 2016
    i was going that route, but for the life of me, couldn't find the code to change the invert checkbox in the Input Manager at runtime. Happen to know it?  XD

    btw, i cant find a FirstPersonControlPlayer in my project. I have:

    FirstPersonCamera
    FirstPersonCameraEditor
    FirstPersonController
    RigidbodyFirstPersonController

    and none contain PlayerMovement.

    Using AC version 1.51g
  • Try this.

    I was referring to the FirstPersonController function within the PlayerMovement.cs script.
  • Nevermind I got it working.

    PlayerInput.cs  line 1414  -> added * invert 
    (where invert is set on Awake)
  • edited May 2020

    PlayerInput.cs line 1414 -> added * invert

    Is this still the method to invert Y axis? Line 1414 seems to be different now.

    Any ideas how to invert Y axis in AC instead of changing the Unity inputs? (Using Rewired so Unity input settings are ignored)

    Edit: Nevermind, got it working by giving the Y sensitivity value in the FirstPersonCamera on the player a negative value.

  • Edit: Nevermind, got it working by giving the Y sensitivity value in the FirstPersonCamera on the player a negative value.

    @ChrisIceBox I'm currently swapping out the player itself to make this work - Choosing the inverted option in a menu swaps out the non-inverted player prefab with a duplicate player prefab that has a negative sensitivity value in its FirstPersonCamera component and vice versa.

    If there's a way to change the sensitivity setting of the FirstPersonCamera by doing Object:Send Message, with a Custom message, please let me know! So far I haven't been able to determine what Method Name I would have to enter for this to work.

  • This script provides two functions to change the sensitivity to two separate values:

    using UnityEngine;
    using AC;
    
    public class SetFirstPersonSensitivity : MonoBehaviour
    {
    
        public Vector2 sensitivityValuesOne, sensitivityValuesTwo;
    
        public void SetSensitivityOne ()
        {
            KickStarter.player.FirstPersonCameraComponent.sensitivity = sensitivityValuesOne;
        }
    
        public void SetSensitivityTwo ()
        {
            KickStarter.player.FirstPersonCameraComponent.sensitivity = sensitivityValuesTwo;
        }
    
    }
    

    You can place it in the scene or make it a prefab, and then trigger it with the Object: Send message Action with a custom message of the function names.

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.