Ejemplo n.º 1
0
static float GCtfHeuristic( GWayNode* i_current, GWayNode* i_next, void* i_data )
{
	CtfAiPlayerComp* comp = (CtfAiPlayerComp*) i_data;
	GVector3 toEnd = i_next->m_Position - i_current->m_Position;
	float toTargetLen = toEnd.LengthSquared();
	GActor* player = GActor::FromHandle( comp->m_Player );
	if( !player )
		return 1.0f;

	GVector3 toPlayer = player->m_position - i_current->m_Position;
	float toPlayerLen = toPlayer.LengthSquared();

	if( toPlayerLen < (250.0f * 250.0f) * 2.0f )
		return FLT_MAX / 5.0f; // this node is BASICALLY off limits...

	return toTargetLen;

	//return toTargetLen;
}
Ejemplo n.º 2
0
void QuatTestComp::ResetCalculation( GActorHandle i_Handle )
{
	GActor* actor = GActor::FromHandle( i_Handle );
	GVector3 facing = -actor->m_rotation.Dir(); // TODO: Fix the z-hack soon..
	GVector3 worldZ( 0.0f, 0.0f, 1.0f );
	float angle = acosf( worldZ.Dot( facing ) );
	GVector3 ortho = worldZ.Cross( facing );
	if( ortho.LengthSquared() > 0.0f )
	{
		ortho.Normalize();
		m_quat.FromAngleAxis( angle, ortho );
	}
}