예제 #1
0
    /// <summary>
    ///
    /// </summary>
    protected override void LateUpdate()
    {
        base.LateUpdate();

        if (Time.timeScale == 0.0f)
        {
            return;
        }

        if (Player.IsFirstPerson.Get())
        {
            UpdatePosition();

            UpdateCameraPosition();

            UpdateCameraRotation();

            UpdateCameraCollision();
        }
        else
        {
            FPCamera.DoCameraCollision();
        }

        UpdateFirePosition();
    }
예제 #2
0
    /// <summary>
    /// runs the collision check for the camera and reacts to collisions
    /// by moving the body (but not the controller) away from collision
    /// surfaces by the same distance as the camera
    /// </summary>
    protected virtual void UpdateCameraCollision()
    {
        FPCamera.DoCameraCollision();

        if (FPCamera.CollisionVector != Vector3.zero)
        {
            Transform.position += FPCamera.CollisionVector;
        }
    }