Transport Fever Wiki

Site Tools

modding:developerinfo:models:events_animations

Differences

This shows you the differences between two versions of the page.

 modding:developerinfo:models:events_animations [2018/02/08 11:17]127.0.0.1 external edit modding:developerinfo:models:events_animations [2019/03/19 10:18] (current) 2018/07/04 12:28 tom 2018/02/08 11:17 external edit Next revision Previous revision 2018/07/04 12:28 tom 2018/02/08 11:17 external edit Line 1: Line 1: ==== Events and Animations ==== ==== Events and Animations ==== + Events are triggered by the game engine and can play animations accordingly,​ for example drive and door animation of vehicles. + + Event names are predefined, while animation names can be freely chosen. + + === Events === + + Events are listed in [[modding:​developerinfo:​models|model files]], which are triggered depending on the state of model. ​ + + The following vehicle events are available: + + |< 100% 15% 25% 15% 15% 15% 15% >| + ^ Event ^ Trigger ^ Aircraft ^ Train ^ Boat ^ Truck / Bus / Tram | + | forever* | running constantly | {{valid.png|}} | {{valid.png|}}| {{valid.png|}}| {{valid.png|}} | + | drive* | while driving | {{valid.png|}} | {{valid.png|}} | {{valid.png|}} | {{valid.png|}} | + | open_all_doors \\ close_all_doors | after arriving at station \\ before departing from station | {{valid.png|}} | {{valid.png|}} | {{valid.png|}} | {{valid.png|}} | + | open_doors_left \\ close_doors_left \\ open_doors_right \\ close_doors_right | after arriving at station \\ before departing from station \\ after arriving at station \\ before departing from station | {{valid.png|}} | {{valid.png|}} | {{valid.png|}} | | + | open_wheels \\ close_wheels| before landing \\ after take-off | {{valid.png|}} | | | | + + *animation is looped ​ + + Note that the wheel rotation and steering as weel as additional animations for aircraft and boats (elevator, aileron, flaps, rudder, paddles, flags) are calculated by the game engine. The mesh files used for these animations can be defined in the [[modding:​developerinfo:​models#​metadata|metadata]] section of the model file. + + The following building and person events are available: + + |< 100% 15% 25% 15% 15% 15% 15% >| + ^ Event ^ Trigger ^ Depot ^ Crossing ^ Industry ^ Person | + | forever* | running constantly | {{valid.png|}} | {{valid.png|}} | {{valid.png|}} | {{valid.png|}} | + | open \\ \\ close | train arriving at crossing \\ vehicle arriving at depot \\ train left crossing \\ vehicle left depot | {{valid.png|}} | {{valid.png|}} | | | + | idle_open* \\ idle_closed* | after crossing opened \\ after crossing closed | | {{valid.png|}} | | | + | productionFull \\ productionHalf | when running above half capacity \\ when neither idle nor exceeding half capacity | | | {{valid.png|}} | | + | walk* \\ idle* \\ sitting* | while walking \\ while idle \\ while sitting | | | | {{valid.png|}} | + + *animation is looped ​ + + Example code: events = { events = { - open_doors_right = { + ​open_doors_right = { - [2] = { name = "​opend1",​ forward = true }, + [2] = { name = "​opend1",​ forward = true }, - [5] = { name = "​opend2",​ forward = true }, + [5] = { name = "​opend2",​ forward = true }, - }, + }, - close_doors_right = { + close_doors_right = { - [2] = { name = "​opend1",​ forward = false }, + [2] = { name = "​opend1",​ forward = false }, - [5] = { name = "​opend2",​ forward = false }, + [5] = { name = "​opend2",​ forward = false }, - }, + }, - open_doors_left= { + open_doors_left= { - [3] = { name = "​opend2",​ forward = true }, + [3] = { name = "​opend2",​ forward = true }, - [4] = { name = "​opend1",​ forward = true }, + [4] = { name = "​opend1",​ forward = true }, - + }, - }, + close_doors_left = { - close_doors_left = { + [3] = { name = "​opend2",​ forward = false }, - [3] = { name = "​opend2",​ forward = false }, + [4] = { name = "​opend1",​ forward = false }, - [4] = { name = "​opend1",​ forward = false }, + }, - }, + }, }, ​ - msh + The number in the square bracket refers to the position of the mesh file listed in the model file starting with 1. 0 is used to reference the model file itself. + === Animations === + + Animations are defined in [[modding:​developerinfo:​models|model]] or [[modding:​developerinfo:​models:​meshes|mesh]] files. They can be keyframe or file based. + + Example code for a keyframe based vehicle door animation: - animations = { + animations = { - opend1 = { + opend1 = { - type = "​KEYFRAME",​ + type = "​KEYFRAME",​ - params = { + params = { - origin = { + origin = { - 0, 0, 0, + 0, 0, 0, - }, + }, - keyframes = { + keyframes = { - { + { - time = 0, + time = 0, - rot = { 0, 0, 0 }, + rot = { 0, 0, 0 }, - transl = { 0, 0, 0 } + transl = { 0, 0, 0 } - }, { + }, { - time = 1100, + time = 1100, - rot = { 92, 0, 0 }, + rot = { 92, 0, 0 }, - transl = { 0.0, 0, 0 } + transl = { 0, 0, 0 } - } + } - } + } - } + } - }, + }, - + }, - }, + ​ + Example code for a file based person animation: + + animations = { + idle = { + params = { + id = "​man01_idle_lod_0/​_root.ani",​ + }, + type = "​FILE_REF",​ + }, + sitting = { + params = { + id = "​man01_sitting_lod_0/​_root.ani",​ + }, + type = "​FILE_REF",​ + }, + walk = { + params = { + id = "​man01_walk_lod_0/​_root.ani",​ + }, + type = "​FILE_REF",​ + }, + }, ​ + + Animation files are stored in the ''​.ani''​ format in the ''​res\models\animation\''​ folder. + +