Thirdperson-OrangeBox

From Valve Developer Community
Jump to: navigation, search

Enabling thirdperson

in the developer console,

sv_cheats 1
thirdperson

Spawning players in thirdperson

Make the following changes to in_camera.cpp:

  • change
void CInput::Init_Camera( void )
 {
 	m_CameraIsOrthographic = false;
 }

to

void CInput::Init_Camera( void )
 {
 	m_CameraIsOrthographic = false;
 	m_fCameraInThirdPerson = true;
 }


Then, to keep Source from changing it back to firstperson, disable the sv_cheats check by commenting out the following lines in CAM_Think

// If cheats have been disabled, pull us back out of third-person view.
 	 if ( sv_cheats && !sv_cheats->GetBool() )
 	{
 		CAM_ToFirstPerson();
 		return;
 	}

change to:

/*  We're using a third-person camera, don't mess with it
 // If cheats have been disabled, pull us back out of third-person view.
 	 if ( sv_cheats && !sv_cheats->GetBool() )
 	{
 		CAM_ToFirstPerson();
 		return;
 	}
 */

NOTE: If your game is strictly in third-person camera, you may want to disable users from switching to first person using the "firstperson" command. To do so, simply comment out this line:

static ConCommand firstperson( "firstperson", ::CAM_ToFirstPerson, "Switch to firstperson camera." );

Credits:

AndreZero and Bluestrike http://developer.valvesoftware.com/wiki/Talk:Third-person_camera#Start_the_player_in_Third_Person