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 Jump to search
Under construction.png
This page is actively undergoing a major edit.
As a courtesy, please do not edit this while this message is displayed.
If this page has not been edited for at least several hours to a few days, please remove this template. This message is intended to help reduce edit conflicts; please remove it between editing sessions to allow others to edit the page.

The person who added this notice will be listed in its edit history should you wish to contact them.

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" );