4

Yes, I know it is similar to this question, but I want further explanation.

I would like to detect two objects colliding, and write the frame number if on that frame the collision happened. Collision itself can be detected using the method described in the previous link, but I don't know on which 'operation', for example, 'scale' in the linked page, should I apply that driver.

Furthermore, I wonder I can run a simple python script for file writing, if a collision is detected using the driver method.

dalbom
  • 63
  • 11

1 Answers1

4

You can use Animation Nodes for this. We compute the distance between the two target objects, if the distance is smaller than the sum of the radii of their bounding sphere, we create a text from the current frame and if not create an empty text, we read an initially empty text block and append the result to it with a line break as separator (Though a separator of your choice can be used), then we write the output to the text block again. Now as soon as they collide, the frame will be written in a new line.

Node Tree

Omar Emara
  • 22,639
  • 5
  • 55
  • 103
  • This is far more amazing than I expected. Thank you so much for introducing me such a nice addon. :D – dalbom Jan 18 '18 at 09:56