how to know if transform position through hit.point ??

i create a simple script for raycast

	public Vector3 velocity;

	public Vector3 rayDirection;
	public Color color;
	public LayerMask hitLayer;
	public Vector3 hitPoint
	public bool hitSomething = false;

	private void Awake()
	{
		rb = GetComponent<Rigidbody>();
		color.a = 255;
	}

	private void FixedUpdate()
	{
		RaycastHit hit;

		if (Physics.Raycast(transform.position, rayDirection, out hit, Mathf.Infinity, hitLayer))
		{
			Debug.DrawRay(transform.position, rayDirection * hit.distance, color);
			hitPoint = hit.point;
			hitSomething = true;
		}
		else
		{
			Debug.DrawRay(transform.position, rayDirection * 5000, Color.white);
			hitSomething = false;
		}
	}

but how can i know if transform through or past latest hit point ??
thanks,

To get the transform of the object you hit, you can use “hit.transform” on the hit object itself like this:

     RaycastHit hit;

     if (Physics.Raycast(transform.position, rayDirection, out hit, Mathf.Infinity, hitLayer))
     {
         [...]
          var hitObjectTransform = hit.transform;
         [...]
     }

The hit.point is of type Vector3 and so it doesn’t contain any data beside the x,y,z coordinates.