Thirdperson-OrangeBox: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
 
Line 21: Line 21:
  }</source>
  }</source>


If camera stucks in only position, use this:
<source lang=cpp>void CInput::Init_Camera( void )
{
m_CameraIsOrthographic = false;
m_fCameraInThirdPerson = true;
    ::CAM_ToThirdPerson();
}</source>


Then, to keep Source from changing it back to firstperson, disable the <tt>sv_cheats</tt> check by commenting out the following lines in <tt>cam_thirdperson.cpp</tt>
Then, to keep Source from changing it back to firstperson, disable the <tt>sv_cheats</tt> check by commenting out the following lines in <tt>cam_thirdperson.cpp</tt>

Latest revision as of 11:42, 26 January 2022

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;
 }

If camera stucks in only position, use this:

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

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

// 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

Stub

This article or section is a stub. You can help by expanding it.