'In the right spot' scripting?

I just found that a script that could tell when one object is in (almost) the same place as another would be practical for some of my work. Does anyone know of clever ways to have a script check when (not ‘if’) one object will be in a specific location during an animation, so that the event can trigger another script? Oh, and I am working with animations, not with the game engine…

One example would be to have the script check when a bullet/rock hits a glass window, so that a script to make the window shatter can be set to start at the right moment, without having to pan the animation back and forth manually to see when is the right frame.

You might want to look into script links. You could set up FrameChanged script link to World, check current frame and act on match.

In animation you can take one shot of bullet upto the glass and then change your setting and
take another for shatter glass.
but if you want to use the script for this,the only way out i can think is getting the loc of the
bullet in every frame and at the desire location you can start shattering of the glass.

I need that explained a bit clearer. Sounds neat, but I don’t understand the details of it.

I need that explained a bit clearer. Sounds neat, but I don’t understand the details of it.

See Buttons Window -> Script -> Scriptlinks. Enable Script Links and you can add script links to your scene. In case you have an object selected, script link can be added for object as well. Material can be used too. There are three types of script links available currently: render, redraw and onFrameChanged.

After adding a script link you can bind a Python script to it. This script will be executed based on chosen type. I think there might be documentation for this useful feature somewhere. Try digging around a bit.