public void LaunchBall()
    {
        velocity += constAcceleration * Time.deltaTime;

        RaycastHit2D hit = Physics2D.Raycast(transform.position, velocity.normalized, velocity.magnitude * Time.deltaTime, IsGroundLayer);
        if (hit.collider != null)
        {
            Vector2 reflectVelocity = Vector2.Reflect(velocity, hit.normal);
            reflectVelocity *= globalsSO.COR;
            velocity = reflectVelocity;
            if (velocity.sqrMagnitude < globalsSO.VelErrorCheck)
            {
                velocity = Vector2.zero;
                Destroy(gameObject);
                isLaunched = false;
            }
        }

        RaycastHit2D obstacleHit = Physics2D.Raycast(transform.position, velocity.normalized, velocity.magnitude * Time.deltaTime, obstacleLayer);
        if (obstacleHit.collider != null)
        {
            Vector2 reflectVelocity = Vector2.Reflect(velocity, obstacleHit.normal);
            reflectVelocity *= globalsSO.COR;
            velocity = reflectVelocity;
            if (velocity.sqrMagnitude < globalsSO.VelErrorCheck)
            {
                velocity = Vector2.zero;
                Destroy(gameObject);
                isLaunched = false;
            }
            Rigidbody2D obstacleRb = obstacleHit.collider.GetComponent<Rigidbody2D>();
            if (obstacleRb != null)
            {
                Vector2 forceDirection = transform.right;
                forceDirection.Normalize();
                obstacleRb.AddForce(forceDirection * impulseOnImpact, ForceMode2D.Impulse);
            }
            
        }

        transform.position += new Vector3(velocity.x * Time.deltaTime, velocity.y * Time.deltaTime, 0);
    }

    public void CalculateInitialVelocity()
    {
        horizontalSpeed = initialSpeed * Mathf.Cos(Mathf.Deg2Rad * launchAngle);
        verticalSpeed = initialSpeed * Mathf.Sin(Mathf.Deg2Rad * launchAngle);
        velocity = new Vector2(horizontalSpeed, verticalSpeed);
    }

    private void CalculateDragForce()
    {
        // Calculate drag force using initial speed
        float dragForce = -0.5f * globalsSO.Drag * globalsSO.Buoyancy * initialSpeed * initialSpeed * Mathf.PI * globalsSO.BallRadius * globalsSO.BallRadius;

        // Apply drag force to vertical velocity component
        velocity.y += (dragForce / globalsSO.BallMass) * Time.deltaTime;
    }

    private void CalculateConstantAcceleration()
    {
        Vector2 gravityForce = globalsSO.BallMass * globalsSO.Gravity * Vector2.down;
        Vector2 buoyancyForce = -globalsSO.BallMass * globalsSO.Gravity * Vector2.up;

        Vector2 netForce = gravityForce + buoyancyForce;
        constAcceleration = netForce / globalsSO.BallMass;
    }
}