Submitted by
Gard on Sat, 2003-11-08 02:55.
Quake 2
Jump pads in Q2? You betcha! -
David Hyde &
Mad Dog
The "angles" key/value pair
OK, this is a long story, but you goons are required to read the whole thing...
that's the price you pay for cool information. My
Tarot teammate and spiritual advisor
Monsto Brukes wanted to simulate Q3 jump pads in Q2 for map testing purposes.
Tarot's bit_twiddling nerd guy (that's me) opened up the Q2 source and started to
plug in an elevation value. But wait... he found that trigger_push code refers to
the "angles" key... but that's not right he says... trigger_push just uses
"angle". Well it turns out id didn't trust you mapper goons to be able to do a
little simple trigonometry, so they published the input for trigger_push as
"angle" only, but the code does not have that limitation.
The "angles" values are pitch (up/down), yaw (left/right) and roll (fall over).
If "angle" is specified for an entity, then the code automatically sets "angles"
to 0,angle,0... and these values are used for the entity. But what happens if
instead of specifying "angle" in the .map file, you set the three "angles"?...
heh heh... you know the answer, don't ya? And all it takes is a little math to
translate those angles into movement directions... but not to worry, Tarot's
bit_twiddling nerd has done that for you. The translations performed by the game
source end up making a positive pitch down from horizontal. Yaw is unaffected by
this, so you'd use the same angle you've previously used for the angle key. And
roll is ignored for trigger_push, which is a shame, really... it would be nice
to have a trigger_push that made you do flips. Anyhow... quick example, and I'm
sure you can take it from there. Say you want the trigger_push to push you up 60
degrees from horizontal and to the west. Set "angles" to _60 180 0. That's it.
So how do you go about using this info in your editor? If your editor allows you
to enter user_defined keys (qED, QERadiant, QuArk), you're all set. Just enter
"angles" for the key and "<_pitch> 0" for the value. If you're using Tread,
open up quake2.gdf, find trigger_push, and enter the following below the "angle"
line:
def_key : string : "angles" : "pitch yaw roll" : ""
If you're using WorldCraft, Mad Dog has already done the work for you...
get his new
.fgd file. If you're using Qoole, stop. (ed. I’d have to agree.)
One qualifier that could foul this up for you: If your editor forces an "angle"
key to be written to the .map file, "angles" will still work as long as it occurs
after the "angle" definition. So if you try this and you get the same old
trigger_push behavior, open up your .map file in a text editor, find the
trigger_push, and delete the "angle" line.
The syntax for an 'angles' keyvalue is:
"angles" "pitch yaw roll"
Pitch can be any number from _90 to 90; negative numbers "aim" up and positive
numbers "aim" down. Yaw can be virtually any positive number, generally 0_360
(this would be the same value one would typically use for 'angle'). Roll can be
any number from _180 to 180; this affects the "canted" view one can achieve with
an info_player_intermission. Depending on the entity, a "roll" value of anything
other than 0 can yield no result, an interesting result, or a result you want to
avoid.
Some example entities by way of explanation:
- Ammo - Ammo need not lie flat. If you want to put a box of ammo
on a tilted floor, or simulate an item amid a jumble of other debris you
can. Note that the bounding box of the ammo does not change position or
orientation, so you may need to work in a wedge_shaped mist brush in
there to get the visual effect just right. Giving values to all three
angles is fine.
- Player starts, deathmatch starts, teleporters - DM spawn points
and teleporter/dest platforms can be canted just like ammo. However the
'angles' value translates into the direction the player looks when he
spawns. So if you want the player to spawn up on a high ledge, looking
down on the action, you could give the spawn point an 'angles' value of
"45 0 0", for example. Even if the player has freelook off and lookspring
on it works fine. I strongly advise against using a "roll" value of
anything other than 0, since the player gets stuck with the canted view.
Until he hits a teleporter dest which straightens him out anyway. Unless
of course you want to simulate drunkeness.
- Strogg ships, Vipers - Simulate diving or launching ships. Or a
crashed misc_bigviper. Looks cool; use all 3 values. Advise the use of a
playerclip brush to avoid weird clipping problems with the misc_bigviper
model in the game.
- Banner - All 3 values work, but the appearance is odd; so "roll"
has little value __ but a slight "pitch" effect could have its place I
suppose.
- Monsters - Good for a laugh. Give a monster_soldier an 'angles'
keyvalue of "60 0 0" and he "swims" on the floor. Too bad monsters drown
in water. Death animations can be even funnier.
- Target_blasters - Want a blaster that shoots up or down at an
angle? No problem. "Roll" values don't matter. Works with lasers too, if
you don't want to bother with an info_null. And it works with the
target_splash too.
- Doors and buttons - This is very very cool. You can have
multi_piece doors that move up/down at angles, and buttons that recess
properly into angled consoles. Figuring out 'lip' may be a problem;
I haven't experimented but I suspect that the game uses either a
horizontal or vertical orientation for calculating 'lip'; so I would
avoid using _45 and 45 for "pitch", so you can get predictable results.
Again, "roll" doesn't matter.
- Weapons, keys, armor, etc - Spinning crap seems to ignore
'angles'. Too bad.
Anyway these are some ideas. In order to use the 'angles' key properly in
Worldcraft, you should set 'angle' to '0'; this removes the 'angle' key from
the .map file. My .FGD prompts you for "pitch yaw roll" for entities which can
make use of "roll", and it prompts you for "pitch yaw 0" for entities which
can't.
The team was so fired up about this that we built a fun DM map for you guys to
check out. We started out making a small tutorial sort of thing, but it got out
of hand pretty quickly and turned into the real deal:
You can download the map here (589Kb).
The map is an r_speeds hog, so if you don't have a 3D card please don't bother.
The .map file is included.
You can download Mad Dogs .FGD
here.
David Hyde:
Mad Dog:
Note: This tutorial was copied almost verbatim from the
Rust Forums (ed. note: the
OLD Rust forums,
that is - Merl) with minimal
editing by raYGunn. It is also
interesting to note the discovery of the usage of the angles key by the authors
was independent and for different purposes.
Hint Brushes De-Mystified
Entity Properties