Beispiel #1
0
    public override void _PhysicsProcess(float delta)
    {
        GroundRay.Call("update", 0.1f + (-Velocity.y * delta));
        ArmWrapper.GlobalTransform = _Camera.GlobalTransform;


        //Joypad Camera movement
        if (Xinput != 0f || Yinput != 0f)
        {
            MoveCamera(Xinput, Yinput, JoySensitivityX, JoySensitivityY);
            ApplyCameraAngle();
        }

        PlayerArms.Singleton.Retract = Translation.DistanceTo(ScanRay.GetCollisionPoint()) < RetractThreshold;
        if (!Imobile)
        {
            UpdateCursorAndCarryWorldPosition();
            if (LiftSystem.Carrying)
            {
                Carry(delta * 3f);
            }
            else
            {
                Scan();
                Interact();
            }
            if (Flying)
            {
                Fly(delta);
            }
            else if (Climbing)
            {
                Climb(delta);
            }
            else
            {
                Walk(delta);
            }
        }
        if (Input.IsActionJustPressed("toggle_fly"))
        {
            Flying   = !Flying;
            Velocity = Vector3.Zero;
            PlayerAnimationTree.Singleton.Active = !Flying;
        }
        HighlightCamera.GlobalTransform = _Camera.GlobalTransform;
    }