Calculating position based on rotations and range

Hello,
I’m doing a game, where FP Character (from standard assets) is carrying a rocket launcher.
I’m checking distance to target by a Physics.Raycast and it works - the problem is that when target is too far, fast its hard to get direct “hit”.
I was planning to cast a Physics.Capsulecast so my “ray” was thicker.
In order to do that I need to calculate position of end sphere.
How do I do that based on my FPS controller rotations?
How do I access my FPS Controller transform from my launcher objcet?
Or should I put launcher script in controller object, and the only put model of launcher?

 if (Input.GetButtonDown(fireButton))
            {
                Vector3 rayDir = transform.TransformDirection(Vector3.up) * 50;

                GameObject target; // = GameObject.FindWithTag("Target");

                
                if (Physics.Raycast(transform.position, transform.TransformDirection(Vector3.up), out hit, shootRange, 1 << 8))// && hit.collider.CompareTag("Target"))
                {

                    Debug.Log("FIRE !!!!!!!! " + hit.collider.name + "  " + hit.collider.tag);
                    target = hit.transform.gameObject;
                    LaunchMissile(target.transform);                    
                }
                else
                {
                    Debug.Log("No target");
                }


            }

I want it to look like:
94092-rysunek1.png

You were right guys - sphere cast works FINE thanks :wink:
I just misunderstood how it works

As slavo mentioned in the comment, SphereCast will probably be easier for you to implement. It works in the same way as a rayCast, in that you give it an origin and a direction, but it also takes a radius so you have a wider ray. You could do something like this:

 float radius = 1;

if (Physics.SphereCast(transform.position, radius, transform.TransformDirection(Vector3.up), out hit, shootRange, 1 << 8))// && hit.collider.CompareTag("Target"))
{
        //Do something
}

Just as a note, if you want the direction a gameObject is facing, you can use transform.forward to get the direction of it’s local z (blue) axis

Your raycast result (out hit) contains the position it hits.
Unless I misunderstood your question completely, that’s all you need.