Curved Path Train (func_train or misc_mdl_train)
func_train is a train in the map, misc_mdl_train is train using a model (.md3, .obj, .ase)
If a path_corner is marked with flag "[2] Train Turn To Face", the train will turn to face that point as it moves -- performing the calculation on the fly. There are no extra fields or variables. Just a flag.
If this sounds too easy and friendly, you are correct. There is diabolical math puzzle not mentioned, the source code shows this X factor.
Above: func_train
Above: misc_mdl_train (.obj or .md3 model)
Inside Map Editor
The map has 8 path_corners that determine train checkpoints. Every other path_corner has flag "[2] Train Turn To Face" set.
For only the corner pictured above we have added 3 extra turning path_corners for an extra "car at intersection" style turn that swings more instead of a "cut the corner" style turn.
Overhead View
Set of map entities
- 8 primary path_corners plus 3 extra for the "car at intersection" style turn for Northeast corner.
- A func_train or misc_mdl_train
- A light we attach to the train. It is a misc_mdl_entity with "nodraw" flag set. (EF_NODRAW 16)
- A smoke emitter (emitter_particles) attached to back of the train.
The light and smoke emitter are optional, provided for covering them without adding an extra tutorial.
The tutorial could reasonably end here. It is just a func_train where every turn has path_corner flag "[2] Train Turn To Face" set. Simple!
Optional: read ahead for super-detail.
Details Of These These Entities (First Using Train.md3 or Train.obj model)
The func_train here when using a model is instead misc_mdl_train. This is because some map editors have different categories of entities and want either a "brush model object type" or a "external model object type".
Here we have a train.md3 or train.obj:
- name train1 ("targetname" "train1")
- speed 300
- model "models/vehicles/train.obj"
- first target is "dest00", a train starting poivt path_corner.
- scale 3. This enlarges the size of the train. The train was too small so upsized it.
- Angles "0 90 0". The middle number is the train direction and 90 is north. (east 0, 270 south, ..)
The Light We Attach To Train
We attach a light to the front of the train. The relative position in the map to the func_train will be where it attachs to the train. We put it 64 north of the train and played with the position until it looked right.
- misc_mdl_entity
- model. Doesn't matter. Pick one so it draws in the map editor. You want to see it in the editor.
- "attach_to" "train1" .. causes it to attach to the train.
- "effects" "16 nodraw plus 4 brightlight" ---> "effects 20"
- nodroptofloor 1 means suspend in air.
This misc_mdl_entity is simply a carrier for the light effect.
The Smoke Emitter (emitter_particles)
We attach a smoke emitter to the back of the train.
- emitter_particles ... run an effect in quake\quake3_quake1\effectinfo.txt
- "effects_name" "train_smoke"
- "attach_to" "train1"
- "interval" "0.2" ... do it every 0.2 seconds
- "active" "1" ... it is on.
After the picture of the map editor properties for this entity, we will look at the text of train smoke.
train_smoke (in effectinfo.txt)
For completion, a quick look at the text of "train_smoke". This was a modification of smoke in one of the DarkPlaces high res packs and tweaked until it looked right.
The colors are similar to HTML colors so 0x302020 is grayish with a slight reddish tone.
At some point reference material will be on this will be on this site on this site.
Brush Model Train (normal func_train using map made train)
Brush model trains have 3 rules.
- Need an origin brush that defines the center of the model ...
- that origin brush also must define the lowest part of the train.
- The train must face east. For all brush models "East" is the front because angle 0 is "East".
Q: Why do curved path trains have rules when normal func_train does not?
A: Unlike normal func_train, we rotate them. That means we must define where the center is with an origin brush. This same origin brush also defines where the bottom of the train is.
Q: What if I want the train to face north?
A: Have it face "East" and set "angles" "0 90 0" -- north is 90, west is 180, south 270.
An origin brush is just a box painted with the texture "common/origin" that is part of the func_train.
Our north facing train has to face "East" with "angles" "0 90 0" (90 is north) -- because the front of all brush models is 0 degrees which is "East".
Pictured: The properies
Pictured: Overhead View
Notes: Reserved for future. At this time, no notes.