I don't do it the same way you are but have you tried returning the instance of the type, ie replace return obj with
something like return obj\mesh?
Anyhow this is how I do it, but I don't know if it will be what you want. Hope it helps.
something like return obj\mesh?
Anyhow this is how I do it, but I don't know if it will be what you want. Hope it helps.
for I = 1 to whatever cill(i)=Make_OBJ(1,False,False,12,cill(i)) next ;in function Function Make_OBJ(shape,par,sol,segm,obj) Make.RB_OBJ=New RB_OBJ Make\parent=par Make\solid=sol Make\segments=segm Select shape Case 1 ;Pill ;Makes the main body and the two spheres for end caps Make\obj=CreateCylinder(Make\segments,Make\solid,Make\parent) Local spheresegments=Make\segments/2 t=CreateSphere(spheresegments,Make\obj) b=CreateSphere(spheresegments,Make\obj) body.objscale=Last objscale ;Scale the pill and position caps ScaleMesh Make\obj,body\x#,body\y#,body\z# ScaleMesh t,body\x#,body\y#,body\z# PositionEntity t,0,body\y#,0 ScaleEntity b,body\x#,body\y#,body\z# PositionEntity b,0,-body\y#,0 Return Make\obj