void Awake()
    {
        // Reference to the camera transform.
        cam = transform;

        // Set camera default position.
        cam.position = player.position + Quaternion.identity * pivotOffset + Quaternion.identity * camOffset;
        cam.rotation = Quaternion.identity;

        // Get camera position relative to the player, used for collision test.
        relCameraPos    = transform.position - player.position;
        relCameraPosMag = relCameraPos.magnitude - 0.5f;

        // Set up references and default values.
        smoothPivotOffset = pivotOffset;
        smoothCamOffset   = camOffset;
        defaultFOV        = cam.GetComponent <Camera>().fieldOfView;
        angleH            = player.eulerAngles.y;

        ResetTargetOffsets();
        ResetFOV();
        ResetMaxVerticalAngle();

        lob  = player.GetComponent <LockOnBehaviour>();
        anim = player.GetComponent <Animator>();
    }
Пример #2
0
 // Start is called before the first frame update
 void Start()
 {
     rb          = GetComponent <Rigidbody>();
     cam         = Camera.main;
     tob         = cam.GetComponent <ThirdPersonOrbitCamBasic>();
     lob         = GetComponent <LockOnBehaviour>();
     anim        = GetComponent <Animator>();
     col         = GetComponent <Collider>();
     defDynFric  = col.material.dynamicFriction;
     defStatFric = col.material.staticFriction;
 }
Пример #3
0
 private void Awake()
 {
     Instance = this;
     cam      = Camera.main;
 }