You can make or access native mesh and use its IntersectRay method. (for 2018+ versions you can use MCG’s wrappers to do the job )
tea = Teapot()
rotate tea (EulerAngles 15 23 44)
(
inverse_tm = inverse tea.objecttransform
tri = snapshotAsMesh tea
temp_target_mesh = createInstance Editable_mesh
meshop.attach temp_target_mesh tri
g = (dotNetClass "Autodesk.Max.GlobalInterface").Instance
IMesh = g.animatable.getanimbyhandle (dotNetObject "System.UIntPtr" (getHandleByAnim temp_target_mesh ))
fn MakeRayNative pos dir tm =
(
-- convert ray from world to local space
_pos = pos * tm
_dir = dir * tm
(g.rayvalue.Create (g.point3.create _pos.x _pos.y _pos.z) (g.point3.create _dir.x _dir.y _dir.z)).toRay
)
intersection_normal = g.point3.create()
intersection_distance = 0.0
for i=1 to 10 do
(
ray_pos = [ random -10 10, random -10 10, 100 ]
ray_dir = -z_axis
_ray = MakeRayNative ray_pos ray_dir inverse_tm
-- .<System.Boolean> IntersectRay <System.Int32>t <Autodesk.Max.IRay>r <System.Single&>at <Autodesk.Max.IPoint3>norm
has_hit = IMesh.IntersectRay (currenttime as integer) _ray &intersection_distance intersection_normal
if has_hit do
(
point pos:(ray_pos + ray_dir * intersection_distance) centermarker:on cross:off wirecolor:red
)
)
free temp_target_mesh
free tri
)