you could probably create and return one but I don’t think mxs would “understand” what it was getting. the generally accepted method is to return an array of values which in turn can be arrays or point3values etc here my implementation of polyop.intersectrayex as an example
def_struct_primitive(polyop_intersectRayEx, polyop, "intersectRayEx");
Value* polyop_intersectRayEx_cf(Value** arg_list, int count)
{
check_arg_count(intersectRayEx, 2, count);
MNMesh* pmesh = get_polyForValue(arg_list[0], MESH_READ_ACCESS, NULL, intersectRayEx);
Ray ray = arg_list[1]->to_ray();
// get the node transforms
INode* node = get_valid_node(arg_list[0], intersectRayEx);
Matrix3 tm = node->GetObjectTM(MAXScript_time());
Matrix3 itm = Inverse(tm);
// convert the ray in to local space
Ray os_ray;
os_ray.p = itm * ray.p;
os_ray.dir = VectorTransform(itm, ray.dir);
float t;
Point3 normal;
int fi;
Tab<float> bary;
if(!pmesh->IntersectRay(os_ray,t,normal,fi,bary))
return &undefined;
// convert bary table into array value
Array* barray = new Array(bary.Count());
for(int i = 0; i < bary.Count(); ++i)
barray->append(Float::intern(bary[i]));
// Return the array containing the intersection details
one_typed_value_local(Array* result);
vl.result = new Array(3);
vl.result->append(new RayValue((os_ray.p + os_ray.dir * t) * tm, Normalize(VectorTransform(tm, normal))));
vl.result->append(Integer::intern (fi+1));
vl.result->append(barray);
return_value (vl.result);
}
with the result looking something like in mxs
#((ray [-22.0326,43.1826,28.3888] [-0.617795,0.767651,-0.170415]), 6, #(0.212238, 0.0, 0.593346, 0.194416))