void Update() { var ray = new Ray3(rayTransform.position.ToVec3(), rayTransform.forward.ToVec3()); Vec3 collisionPoint; if (ray.IntersectTriangle(triangle, out collisionPoint)) { Debug.DrawLine(ray.origin.ToVector3(), (ray.origin + (ray.direction * 5)).ToVector3(), Color.red, 0, false); Debug.DrawLine(ray.origin.ToVector3(), collisionPoint.ToVector3(), Color.green, 0, false); } Graphics.DrawMesh(triangleMesh, Matrix4x4.identity, triangleMaterial, 0); }