3
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ Is it related with bpy.app.handlers.frame_change_pre? $\endgroup$ – dalbom Jan 17 '18 at 16:17
3
$\begingroup$

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

$\endgroup$
  • $\begingroup$ This is far more amazing than I expected. Thank you so much for introducing me such a nice addon. :D $\endgroup$ – dalbom Jan 18 '18 at 9:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.