Hello,
I needed a help regarding creating python add-on in which the simulation should stop as soon as collision is detected. Currently, the collision is detected successfully but it does not stop the simulation. Also, the tolerance does not seem to work in the ‘detector.testAllCollisions()’. Following is the part of the code. I highly appreciate your help.
detector = sim.newCollisionDetector()
#Don’t include the cube as the object
detector.NodeListA = [(comp, VC_NODELIST_INCLUDE, VC_NODELIST_TREE)]
detector.NodeListB = [(block, VC_NODELIST_INCLUDE, VC_NODELIST_TREE)]
insideHit = detector.testAllCollisions(2.0)
print(insideHit)
def OnRun():
if insideHit:
app.stopSimulation()
print(‘Collision Detected’)