CCG/Modelling: Animation Events
(One intermediate revision by one user not shown) | |||
Line 90: | Line 90: | ||
− | [[Modelling: Tenders|Previous Page]] . . . . [[Modelling: Level of Detail Mesh Reduction|Next Page]] | + | [[CCG/Modelling: Tenders|Previous Page]] . . . . [[CCG/Modelling: Level of Detail Mesh Reduction|Next Page]] |
==Return to CCG Index== | ==Return to CCG Index== | ||
[[Content Creator's Guide]] | [[Content Creator's Guide]] |
Latest revision as of 13:25, 15 June 2011
Contents |
[edit] Animation Events
Sounds events and generic events can be linked to an animation key-frame to give great control over sound and script timing for industry and scenery assets.
When an animation file (.kin file) is exported from 3DSMmax (or GMax), the exporter will make a query for an event file. Tick the box and you will be asked to browse to the event file.
The event information is added to the contents of the new animation file.
[edit] The Event File
(filename.evt)
Format: FrameNum EventType EventName.
The event file consists of a list of events and is set up as a simple text file. Each event consists of the frame number, followed by the event type (Sound_Event or Generic_Event), then the event name. Sound events are generally referenced as a trigger within the asset's config.txt file (or through script). All events start on a new line (should there be more than one)
[edit] Sound and Generic Events:
- A Sound_Event tells Trainz when to play a sound, relative to an animation keyframe.
- A Generic_Event is an animation keyframe reference for script timing and control.
[edit] Example 1: Lumbermill
The animation in the max file is set up over 1000 frames.
We want a single sound to play on frame 760 as a log runs through the mill on the conveyor. When exporting the kin animation we are queried for an event file.
Check the Query for Event File box and browse for the lumbermill.evt file. This file has been prepared earlier and is as follows.
lumbermill.evt
760 Sound_Event logcut 999 Generic_Event animstop
An excerpt from the Lumbermill config.txt file (note the trigger) :
soundscript { log_cut { trigger logcut attachment a.sawsound nostartdelay 1 repeat-delay 1 distance 10,400 sound { 0 log_cutting.wav } } }
Note: For script reference please refer to Scripting
[edit] Example 2: Looping sounds:
Not only can we control when a single sound plays but we can also control the start and the stop of a looping sound by adding another Sound_Event with a / before the relevant name. In the example below the sound starts on frame 370 and ends on 589.
looping.evt
370 Sound_Event reverse 589 Sound_Event /reverse
config.txt entries :-
soundscript { backup { attachment a.sound trigger reverse repeat-delay 0 distance 5,100 sound { 0 warning.wav } } }
Important Note:
The Max file in Example 1 has 1000 frames:
- One thing to note is that although the Max file states the frames are from 0 - 1000 frames, we must remember that frame 999 is the last one. On a looping time scale, frame 1000 is the same time as frame 1.
- Therefore, the Generic-Event at the end of the animation is thus:
999 Generic_Event animstop
Previous Page . . . . Next Page