Created
January 21, 2019 11:41
-
-
Save theresajayne/0679387bcfe6d2474c69df319c4d732f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void ABaseCharacter::StartFire() | |
{ | |
ABasePlayerController* controller = Cast<ABasePlayerController>(Controller); | |
if (!controller || !controller->IsGameInputAllowed()) | |
return; | |
// TODO this will need tweaking for high latency situations (client decision only for now) | |
if (myWeapon) | |
{ | |
FHitResult OutHit; | |
FVector start = myCamera->GetComponentLocation(); | |
FVector end = start + myCamera->GetForwardVector() * 100000.0f; | |
FCollisionQueryParams CollisionParams; | |
CollisionParams.AddIgnoredActor(this); | |
CollisionParams.AddIgnoredActor(myWeapon); | |
FCollisionResponseParams CollisionResponseParams; | |
if (GetWorld()->SweepSingleByChannel(OutHit, start, end, FQuat::Identity, ECollisionChannel::ECC_Visibility, FCollisionShape::MakeSphere(5.0f), CollisionParams, CollisionResponseParams)) | |
myWeapon->Fire(OutHit.Location); | |
else | |
myWeapon->Fire(end); | |
} | |
} | |
void ABaseCharacter::StopFire() | |
{ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment