I have a ray going from the camera; however, I would like to change it by having the ray go from a GameObject.

I followed a tutorial, and everything worked great. However, I am planning for the camera to be able to look around; however, the bullet is traveling to the center of the screen instead of going straight out of the barrel. Do you know how to make the ray go out of an empty game object instead of the viewport? Sorry if my terminology is all wrong; I am still learning. Thanks in advance! (:

Here is the code I need to change; however, I don’t know how. My best guess is to change the public Camera fpsCam into a public GameObject BulletGoThere. I probably need a better name. then Ray ray = BulletGoThere... I am trying to figure out what or how I should change this part of the script.

public Camera fpsCam;

//Find the exact hit position using a raycast
Ray ray = fpsCam.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0)); //Just a ray through the middle of your current view
RaycastHit hit;

//check if ray hits something
Vector3 targetPoint;
if (Physics.Raycast(ray, out hit))
targetPoint = hit.point;
targetPoint = ray.GetPoint(75); //Just a point far away from the playertype or paste code here