Thirdperson-OrangeBox: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(→‎Spawning players in thirdperson: added <tt> tags to the sv_cheats convar)
No edit summary
Line 8: Line 8:
Make the following changes to <tt>in_camera.cpp</tt>:
Make the following changes to <tt>in_camera.cpp</tt>:
*change  
*change  
  <code>void CInput::Init_Camera( void )
  <source lang=cpp>void CInput::Init_Camera( void )
  {
  {
  m_CameraIsOrthographic = false;
  m_CameraIsOrthographic = false;
  }</code>
  }</source>


to
to


  <code>void CInput::Init_Camera( void )
  <source lang=cpp>void CInput::Init_Camera( void )
  {
  {
  m_CameraIsOrthographic = false;
  m_CameraIsOrthographic = false;
  m_fCameraInThirdPerson = true;
  m_fCameraInThirdPerson = true;
  }</code>
  }</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_Think</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_Think</tt>
  <code>// If cheats have been disabled, pull us back out of third-person view.
  <source lang=cpp>// If cheats have been disabled, pull us back out of third-person view.
  if ( sv_cheats && !sv_cheats->GetBool() )
  if ( sv_cheats && !sv_cheats->GetBool() )
  {
  {
  CAM_ToFirstPerson();
  CAM_ToFirstPerson();
  return;
  return;
  }</code>
  }</source>
change to:
change to:
  <code>/*  We're using a third-person camera, don't mess with it
  <source lang=cpp>/*  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 cheats have been disabled, pull us back out of third-person view.
  if ( sv_cheats && !sv_cheats->GetBool() )
  if ( sv_cheats && !sv_cheats->GetBool() )
Line 37: Line 37:
  return;
  return;
  }
  }
  */
  */</source>


'''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:
<source lang=cpp>
static ConCommand firstperson( "firstperson", ::CAM_ToFirstPerson, "Switch to firstperson camera." );
</source>
===Credits:===
===Credits:===
AndreZero
AndreZero

Revision as of 13:42, 25 March 2012

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

Stub

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