Talk:Point viewcontrol

From Valve Developer Community
Revision as of 03:42, 10 August 2006 by Ndnichols (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, 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)