First up I am a newbie on Maxscript. I have seen script for collision detection for specific objects I also want to write to a txt file the objects that are For example all objects with the name "Prism*" that collide with Cylinder001 I want to colour red and write to the text file. I have made some attempt at code;
fn collisionDetection node1 node2 =
(
if intersects node1 node2 then
(node1.mesh * node2.mesh).numverts > 0
else
false
)
dir =getFilenamePath (getThisScriptFilename())
makeDir dir
OutputTextFile = dir + "Output.txt"
if (doesFileExist OutputTextFile) do deleteFile OutputTextFile
filestreamvar = openFile OutputTextFile mode:"w"
if filestreamvar == undefined do
(
createFile OutputTextFile
filestreamvar = openFile OutputTextFile mode:"w"
myObjects = $'Prim*' as array
for i = 1 to myObjects.count do
(
nam = myObjects[i].name
if collisionDetection $myobject[i] $'Cylinder001' do
(
print myobjects[i] to:filestreamvar
)
)
edit OutputTextFile
close filestreamvar
I haven't added code for colouring the object that is true as I am struggling with the output in a textfile already. Can somebody please help? thank you.