How to get a Vector3 from a RaycastHit variable?

I’m making an FPS and right now I’m working on making the gun aim in the middle of the screen. I’m trying to achieve this by casting a ray from my camera and making my bullets look at that target. I know how to code everything except how to get the point at which my raycast is hitting any gameobject. Here’s my code so far, I didn’t attempt to get a Vector3 from the ray, I just tried to see if I could get a value from the rayPoint variable? Thanks!

//casts a ray to find a point in the middle of the screen for the bullet to aim at, so aiming is easier

//the length of the ray
var distance : int;
		
		
		function Update () {
		
		//makes a ray and gives back the point it is hitting
		
			//this is the point in space the bullet will look at
			var rayPoint : RaycastHit;
			
			//a direction
			var fwd = transform.TransformDirection(Vector3.forward);
		
				//casts the ray
				if(Physics.Raycast(transform.position, fwd, rayPoint, distance)) {
			
					if(rayPoint.GameObject) {
					
						Debug.Log("works");
						
					}
					
				}
				
				
				
				
		}
				

P.S. I’m working on making good comments throughout scripts, if you can, can you tell me if I did a good job commenting the script?

The Vector3 of the point that the raycast hit will be rayPoint.point.

Read this for further information.