void TCompCharacterController::update(float dt)
{
	PROFILE_FUNCTION("update");
	if (m_active) {
		RecalcOnGround();
		UpdateFriction(dt);
		RecalcSpeed(dt);
		RecalcMovement(dt);
		ApplyPendingMoves(dt);
		UpdateMeshTransform();
	}
}
Beispiel #2
0
/*
========================
idAimAssist::UpdateNewAimAssist
========================
*/
void idAimAssist::UpdateNewAimAssist()
{

	angleCorrection = ang_zero;
	frictionScalar = 1.0f;
	idEntity* lastTarget = targetEntity;
	targetEntity = NULL;
	
	// is aim assisting allowed?  If not then just bail out
	if( !aa_targetAimAssistEnable.GetBool() )
	{
		return;
	}
	
	bool forceLastTarget = false;
	idVec3 targetPos;
	
	idEntity* entity = NULL;
	if( forceLastTarget )
	{
		entity = lastTarget;
		targetPos = lastTargetPos;
	}
	else
	{
		entity = FindAimAssistTarget( targetPos );
	}
	
	if( entity != NULL )
	{
	
		UpdateFriction( entity, targetPos );
		
		// by default we don't allow adhesion when we are standing still
		const float playerMovementSpeedThreshold = Square( aa_targetAdhesionPlayerSpeedThreshold.GetFloat() );
		float playerSpeed = player->GetPhysics()->GetLinearVelocity().LengthSqr();
		
		// only allow adhesion on actors (ai) or players.  Disallow adhesion on any static world entities such as explosive barrels
		if( playerSpeed > playerMovementSpeedThreshold )
		{
			UpdateAdhesion( entity, targetPos );
		}
		
		targetEntity = entity;
	}
	
	lastTargetPos = targetPos;
}