Message 1 of 7
How to execute a script on loading a scene?

Not applicable
12-12-2008
10:38 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I made a little script that switches fog on/off depending on the z position of a camera. (A greenish fog is switched on when the camera goes below sea level...)
However i keep forgetting to run the script when I load the scene. So I rendered an animation and it turns out the fog didn't do its thing.
Is there a way to embed a script in a scene, so it is executed when the scene is loaded??
MLB
callbacks.addScript #preRenderEval "mlbSwitchUnderwater()" id:#mlbUW
fn mlbSwitchunderwater =
(
mlbCamera = $Camera04
mlbFog = getAtmospheric(1)
if mlbCamera.position.z > 0 then
setactive mlbFog false
else
setactive mlbFog true
)
However i keep forgetting to run the script when I load the scene. So I rendered an animation and it turns out the fog didn't do its thing.
Is there a way to embed a script in a scene, so it is executed when the scene is loaded??
MLB