How i could put a object at the end of the raycast?

I’m trying to make bullet holes on unity 3d , my idea is put a things on the raycast hit.hit but it doesn’t work

I’m trying to make it by this way, if someone could help me:

if (Guns.inst.portal_gun == true)
{
RaycastHit hit;
Physics.Raycast(Shooter.transform.position, Shooter.transform.TransformDirection(Vector3.forward), out hit, Objects
hit.point = Portal1.transform.position;
);

}

Your last line is flipped. a=b is like the picture a<=b. It copies b into a. Flip the parts around that last ='s.

1 Like

Change the line
hit.point = Portal1.transform.position;
to
Portal1.transform.position = hit.point;