Sources/CryGame C++/Solution1/CryGame/Spectator.cpp
//////////////////////////////////////////////////////////////////////////
// Initialize the spectator-container.

Initialize the spectator-container.
Initialize the spectator - container .
bool CSpectator::Init()
{
	IEntity *entity = GetEntity();
	entity->GetScriptObject()->SetValue("type", "spectator");
	entity->SetCamera(m_pGame->GetSystem()->GetIEntitySystem()->CreateEntityCamera());
	entity->GetCamera()->GetCamera().Init(m_pGame->GetSystem()->GetIRenderer()->GetWidth(),m_pGame->GetSystem()->GetIRenderer()->GetHeight());	
	m_pTimer=m_pGame->GetSystem()->GetITimer();
	entity->SetNeedUpdate(true);
	entity->SetNetPresence(true);			
	m_roll = 0;
	float fMass=100.0f;
	float fHeight=1.2f;
	float fEyeHeight=1.7f;
	float sphere_height=0.6f;
	float radius=0.6f;
	float fGravity=0.0f;
	entity->CreateLivingEntity(fMass,fHeight,fEyeHeight,sphere_height,radius,-1,fGravity,true,true);
	pe_player_dynamics pd;
	pd.bActive = 1;
	pd.kAirControl=1.0f;
	pd.bSwimming=1;
	entity->GetPhysics()->SetParams(&pd);
	{
		pe_params_flags pf;
		pf.flagsAND=~(lef_push_players | lef_push_objects);
		entity->GetPhysics()->SetParams(&pf);
	}
	{
		pe_params_part pp;
		pp.ipart=0;
		pp.flagsAND=0;
		entity->GetPhysics()->SetParams(&pp);
	}
	return true;
}
bool CSpectator :: Init ( ) { IEntity * entity = GetEntity ( ) ; entity -> GetScriptObject ( ) -> SetValue ( " " , " " ) ; entity -> SetCamera ( m_pGame -> GetSystem ( ) -> GetIEntitySystem ( ) -> CreateEntityCamera ( ) ) ; entity -> GetCamera ( ) -> GetCamera ( ) . Init ( m_pGame -> GetSystem ( ) -> GetIRenderer ( ) -> GetWidth ( ) , m_pGame -> GetSystem ( ) -> GetIRenderer ( ) -> GetHeight ( ) ) ; m_pTimer = m_pGame -> GetSystem ( ) -> GetITimer ( ) ; entity -> SetNeedUpdate ( true ) ; entity -> SetNetPresence ( true ) ; m_roll = 0 ; float fMass = 100.0f ; float fHeight = 1.2f ; float fEyeHeight = 1.7f ; float sphere_height = 0.6f ; float radius = 0.6f ; float fGravity = 0.0f ; entity -> CreateLivingEntity ( fMass , fHeight , fEyeHeight , sphere_height , radius , -1 , fGravity , true , true ) ; pe_player_dynamics pd ; pd . bActive = 1 ; pd . kAirControl = 1.0f ; pd . bSwimming = 1 ; entity -> GetPhysics ( ) -> SetParams ( & pd ) ; { pe_params_flags pf ; pf . flagsAND = ~ ( lef_push_players | lef_push_objects ) ; entity -> GetPhysics ( ) -> SetParams ( & pf ) ; } { pe_params_part pp ; pp . ipart = 0 ; pp . flagsAND = 0 ; entity -> GetPhysics ( ) -> SetParams ( & pp ) ; } return true ; }
Initialize the spectator-container.
Initialize the spectator - container .
// set camera
 // needed to sync m_eiHost
