Update AI for Improved Hit Detection & Projectiles
This commit is contained in:
parent
c7a52e42a5
commit
768d53549f
BIN
EndlessVendetta/Content/AI/Enemy/Basic/BP_BasicEnemyCharacterSwat.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/AI/Enemy/Basic/BP_BasicEnemyCharacterSwat.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/AI/Enemy/Basic/BT_BasicEnemy.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/AI/Enemy/Basic/BT_BasicEnemy.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/FirstPerson/Blueprints/WBP_Crosshair.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/FirstPerson/Blueprints/WBP_Crosshair.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/__ExternalActors__/Levels/AITest/B/8N/O8PP5KE5USY7FTAE75J65R.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/__ExternalActors__/Levels/AITest/B/8N/O8PP5KE5USY7FTAE75J65R.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/__ExternalActors__/Levels/AITest/B/O6/IM2ZR0FZ5KH20UIRPAQT2P.uasset
(Stored with Git LFS)
Normal file
BIN
EndlessVendetta/Content/__ExternalActors__/Levels/AITest/B/O6/IM2ZR0FZ5KH20UIRPAQT2P.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -20,16 +20,17 @@ EBTNodeResult::Type UBTTask_AttackPlayer::ExecuteTask(UBehaviorTreeComponent& Ow
|
||||
{
|
||||
if (const UBlackboardComponent* const Blackboard = OwnerComp.GetBlackboardComponent())
|
||||
{
|
||||
FVector const Origin = AIController->GetPawn()->GetActorLocation();
|
||||
FVector const Start = Origin + FVector(0.f, 0.f, 30.f);
|
||||
FVector const PlayerLocation = Blackboard->GetValueAsVector("TargetLocation");
|
||||
USkeletalMeshComponent* const GunSKMesh = Cast<USkeletalMeshComponent>(AIController->GetPawn()->GetComponentsByTag(USkeletalMeshComponent::StaticClass(), "Gun")[0]);
|
||||
FVector const Origin = IsValid(GunSKMesh) ? GunSKMesh->GetComponentLocation() : AIController->GetPawn()->GetActorLocation() + FVector(0.f, 0.f, 30.f);
|
||||
FVector const Start = Origin;
|
||||
FVector const End = Origin + AIController->GetPawn()->GetActorForwardVector() * 10000.f;
|
||||
if (AEnemyCharacter* const EnemyCharacter = Cast<AEnemyCharacter>(AIController->GetPawn()))
|
||||
{
|
||||
EnemyCharacter->FireWeapon.Broadcast();
|
||||
EnemyCharacter->SetFiring(true);
|
||||
FCollisionQueryParams QueryParams;
|
||||
QueryParams.AddIgnoredActor(AIController->GetPawn());
|
||||
if (FHitResult HitResult; GetWorld()->LineTraceSingleByChannel(HitResult, Start, PlayerLocation, ECC_Pawn, QueryParams))
|
||||
if (FHitResult HitResult; GetWorld()->LineTraceSingleByChannel(HitResult, Start, End, ECC_Pawn, QueryParams))
|
||||
{
|
||||
if (IsValid(HitResult.GetActor()))
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user