This is a first person camera system I whipped up from scratch, with some help from various people here at The Hive (thanks to xXx-Tricky-xXx for letting me bounce ideas off him and PurplePoot for calming my fears about getLocZ()) and the ideas of the the people of the
FPS Mod Project at wc3campaigns (especially TheEpigoni and Ant).
See the world through the eyes of a rifleman unit! What this camera system does is keep a player's camera targeted just enough ahead of a rifle unit with an appropriate Zoffset and Angle of Attack so that the player sees what the rifleman would see in game. Appropriate Zoffsets and Angles of Attack are calculated dynamically, so this Camera system works in any kind of terrain.
Additionally, map makers can replace the rifleman with any unit they wish just by messing with the variables in the constants trigger.
I'm leaving it as a First Person Camera System for one player but it can be easily changed to be usable for multiple players. Creative map makers may even figure out how to use different first person units for each player.
The system is barely optimized. All the memory leaks are taken care of (hopefully), but there are still a few things I can do to make it run better. Maybe I'll do that in the future. Watch for updates.
Some things that may seem like bugs:
This will not work well for flying units. Flying units follow a different Z height map than ground units and cameras do. This system compensates for the height map cameras follow but I haven't figured out how to compensate for the height map flying units follow.
Wrong Zoffsets and Angles of Attack at bridges and water: fixable via Unit enters Region Events and some math
Camera bounds at edge of map: simply prevent units from going there.
NOTE THAT THIS A FIRST PERSON CAMERA TEMPLATE, NOT A FIRST PERSON SHOOTER TEMPLATE. I'm leaving that up to you guys
. Besides, the stuff the FPS Mod team has already done is probably better for that.
Keywords:
First person camera, first person shooter, template, camera triggers, triggers.