First Person Ragdolls

From Valve Developer Community
Revision as of 05:15, 23 July 2006 by Wunderboy (talk | contribs) (WIP)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Ragdoll death from first person perspective in HL2DM

In most Source multi-player mods, when a player dies the view switches from first to third person perspective. This following simple code change allows you to give the player an option of seeing things from the ragdolls perspective, in short letting it see the world through the ragdoll's own eyes.

Pre-requisites

For the code to work, your player model needs an attachment called eyes which represents where on the ragdoll the players view will come from. In the case of the default HL2 human characters they already have one but if your player model doesn't you can add it in via the QC File and HLMV.

Code changes

The following is for mods based on HL2DM but should work with others with some minor editing.

c_hl2mp_player.cpp

As this code is clientside, we're making edits to the file cl_dll\hl2mp\c_hl2mp_player.cpp.

The first part is to add a console command to enable or disable first person ragdolls. This should be placed at the top of the file along with the other console commands:

static ConVar cl_fpragdoll ( "cl_fpragdoll", "0", FCVAR_DONTRECORD | FCVAR_ARCHIVE, "Use first person ragdolls" );