When a node with a simpleMeshMod applied is modified i would like to find some positions on the mesh either with intersectRay or raymeshgridIntersect and store them as a parameter. However, running any method with the node as an argument in the modifyMesh event will cause an infinite loop/stack overflow… even print owningNode . Can i achieve what i’m looking for with simpleMeshMod or should i go another route?
plugin simpleMeshMod hitTestMod
name:"hitTestMod"
classID:#(0x68c129d6, 0x32ec6619)
category:"hit test"
(
parameters main
(
thePos type:#point3
nodeMon type:#maxObject subanim:on
)
on modifyMesh do
(
print "Modifying"
print owningNode.pos
print nodeMon.node.pos
-- will crash max
-- print owningNode
-- will crash max
-- print nodeMon.node
-- will crash max
-- local hitRay = intersectRay owningNode (ray [0,0,0] [0,0,-1])
-- thePos = if hitRay != undefined then hitRay.pos else [0,0,0]
)
on attachedtonode node do
(
nodeMon = NodeTransformMonitor node:node
)
)
A big thanks to swordslayer for his in depth function publishing tutorial. Still wrapping my head around it, but gave me a practical starting point.