How do I tell where the Ray Intersected

Hey guys,

I was wondering how I could get the location of the collision between the ray and a target… I want to use it to put a bullet hole there…

Thanks, Gibson

c# code:

Vector3 hitPosition;
if (Physics.Raycast(gunCoordinateVector3, vectorDirection, out hit, lengthOfRay)
{
hitPosition = hit.point;
}

Is there a way I could get it in JS?

It’s pretty much the same thing…

var hitPosition: RaycastHit;
if (Physics.Raycast(gun, vectorDirection, hit, lengthOfRay))
{
hitPosition = hit.point;
}