bool AThirdPersonCppCharacter::IsForward(const FVector& vTarget)
{
bool bForward = false;
FVector vDir = vTarget - GetActorLocation();
vDir.Normalize();
FVector vFwd = GetActorForwardVector();
float fDot = FVector::DotProduct(vFwd, vDir);
if ( fDot >= 0.f )
{
bForward = true;
}
return bForward;
}
bool AThirdPersonCppCharacter::IsRight(const FVector& vTarget)
{
bool bRight = false;
FVector vDir = vTarget - GetActorLocation();
vDir.Normalize();
FVector vRight = GetActorRightVector();
float fDot = FVector::DotProduct(vRight, vDir);
if ( fDot >= 0.f )
{
bRight = true;
}
return bRight;
}
|