Talk:Point viewcontrol
		
		
		
		Jump to navigation
		Jump to search
		
There is a bug with the camera pointing at the targetted entity. Currently (8/9/06) the camera always points to the origin when a target is set. To fix this, go into the code and open triggers.cpp. Starting at line 2892, the code looks like
if ( m_iAttachmentIndex )
{
 	Vector vecOrigin;
	m_hTarget->GetBaseAnimating()->GetAttachment( m_iAttachmentIndex, vecOrigin );
	VectorAngles( vecOrigin - GetLocalOrigin(), vecGoal );
}
else
{
	if ( m_hTarget )
	{
		VectorAngles( m_hTarget->GetLocalOrigin() - GetLocalOrigin(), vecGoal );
	}
	else
	{
		// Use the viewcontroller's angles
		vecGoal = GetAbsAngles();
	}
}
Change the code to be this:
if ( m_iAttachmentIndex )
{
	Vector vecOrigin;
	m_hTarget->GetBaseAnimating()->GetAttachment( m_iAttachmentIndex, vecOrigin );
	VectorAngles( vecOrigin - GetAbsOrigin(), vecGoal ); //Changed to use AbsOrigin
}
else
{
	if ( m_hTarget )
	{
		VectorAngles( m_hTarget->GetAbsOrigin() - GetAbsOrigin(), vecGoal ); //Changed to use AbsOrigin
	}
	else
	{
		// Use the viewcontroller's angles
		vecGoal = GetAbsAngles();
	}
}
--Ndnichols 20:42, 9 Aug 2006 (PDT)