⮞ Go to NeoFPS.com

    Show / Hide Table of Contents

    Aim Controllers

    Overview

    Aim controllers take input and control a character's look direction before additive effects are applied.

    Turn Rate

    The aimer turn rate can be altered using the turnRateMultiplier property. This is used when setting the first person camera field of view, for example when aiming down sights.

    Setting Yaw And Pitch

    You can modify the aim controller's rotation from scripts using the following methods:

    void AddYaw (float rotation);
    
    void AddPitch (float rotation);
    
    void AddRotation (float y, float p);
    

    Aim Constraints

    The aim controller can be constrained to a specific range of rotations on either the vertical or horizontal axes or both. This is used in situations such as climbing ladders or using a mounted turret, where it would be unnatural for the character to be able to turn a full 360 degrees.

    If the aim controller rotation is outside of the constraints when they are set, then it uses a damped rotation to smoothly turn into the constraints.

    Since the fps character is able to change their up direction, the yaw constraint must use a direction vector for the constraints center. This means that as the character tilts, they can still constrain to the direction. Camera pitch is relative to the character.

    In order to set the aim controller constraints from a script you can use the following methods on the aim controller component:

    void SetYawConstraints(Vector3 forward, float range);
    
    void SetPitchConstraints(float minimum, float maximum);
    
    void ResetYawConstraints();
    
    void ResetPitchConstraints();
    

    See Also

    FirstPersonCamera Behaviour

    additive-Effects

    Unity Camera

    Back to top Copyright © 2019 Yondernauts Game Studios Ltd
    Generated with DocFX