⮞ Go to NeoFPS.com

    Show / Hide Table of Contents

    FirstPersonCameraTransformConstraints MonoBehaviour

    Overview

    The FirstPersonCameraTransformConstraints behaviour acts as an enhanced, combined position constraint and rotation constraint. It aligns the camera object with one or more targets based on priority and strength. An example usage is in first person characters with a full animated body. The constraints can be used to align the camera to the head bone in the character skeleton. You can add new constraints at runtime using a priority system, and position and rotation can each be assigned different strengths, meaning that the constraints will blend with the next lowest priority constraint if they have a strength lower than 1. In the full body character example, this allows a firearm using the CameraConstraintsAimer firearm module to align the camera to the weapon optics by setting runtime constraints.

    To add or remove constraints you can use the following methods:

    public void AddPositionConstraint(IFirstPersonCameraPositionConstraint constraint, int priority, float blendDuration);
    public void AddRotationConstraint(IFirstPersonCameraRotationConstraint constraint, int priority, float blendDuration);
    public void RemovePositionConstraint(IFirstPersonCameraPositionConstraint constraint, float blendDuration);
    public void RemoveRotationConstraint(IFirstPersonCameraRotationConstraint constraint, float blendDuration);
    

    Inspector

    FirstPersonCameraTransformConstraints

    Properties

    Name Type Description
    Default Target Transform The default target will act as a position constraint from start. Use this for full body to match to the head bone. This only constrains position, not rotation.
    Position Damping Float A damping factor applied to the default target position constraint to prevent excessive jerkiness during animation blends.

    See Also

    CameraConstraintsAimer

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