Minor - Mushroom/Projectile interaction

Ok, le reste de la fonction ne marchait pas à cause d'un BlockAll qui s'était infiltré dans le code du Mushroom
Je vais passer à l'interaction avec le centipede
This commit is contained in:
NisemonoQ
2025-11-04 23:34:15 +01:00
parent 064d4cd576
commit 469451e491
2 changed files with 9 additions and 7 deletions

View File

@@ -33,7 +33,7 @@ AM4_Mushroom::AM4_Mushroom()
GetStaticMeshComponent()->SetRelativeScale3D(FVector(1.f, 0.45f, 0.20f)); GetStaticMeshComponent()->SetRelativeScale3D(FVector(1.f, 0.45f, 0.20f));
// Set collision profile to block all // Set collision profile to block all
GetStaticMeshComponent()->SetCollisionProfileName(TEXT("BlockAll")); GetStaticMeshComponent()->SetCollisionProfileName(TEXT("OverlapAll"));
} }
@@ -46,12 +46,15 @@ void AM4_Mushroom::BeginPlay()
void AM4_Mushroom::OnHit(UPrimitiveComponent* HitComp,AActor* OtherActor,UPrimitiveComponent* OtherComp,FVector NormalImpulse,const FHitResult& Hit) void AM4_Mushroom::OnHit(UPrimitiveComponent* HitComp,AActor* OtherActor,UPrimitiveComponent* OtherComp,FVector NormalImpulse,const FHitResult& Hit)
{ {
// check if the other actor is a projectile
AM4_Projectile* Projectile = Cast<AM4_Projectile>(OtherActor); AM4_Projectile* Projectile = Cast<AM4_Projectile>(OtherActor);
if (!Projectile) if (!Projectile)
return; {
return;
}
if (DestructionHit++ == MushLife) if (DestructionHit++ == MushLife)
Destroy(); {
Destroy();
}
} }

View File

@@ -35,7 +35,7 @@ AM4_Projectile::AM4_Projectile()
} }
ProjectileMeshComponent->SetMaterial(0, ProjectileMat); ProjectileMeshComponent->SetMaterial(0, ProjectileMat);
ProjectileMeshComponent->SetRelativeScale3D(FVector(.8f, .3f, .35f)); ProjectileMeshComponent->SetRelativeScale3D(FVector(.3f, .3f, .35f));
ProjectileMeshComponent->SetMobility(EComponentMobility::Movable); ProjectileMeshComponent->SetMobility(EComponentMobility::Movable);
ProjectileMeshComponent->SetRelativeLocation(FVector::ZeroVector); ProjectileMeshComponent->SetRelativeLocation(FVector::ZeroVector);
@@ -82,7 +82,6 @@ void AM4_Projectile::FireInDir(const FVector& ShootDir)
{ {
SetActorLocation(InitialLoc); SetActorLocation(InitialLoc);
ProjectileMovementComponent->Velocity.Z = -1 * ((ShootDir.Z + 380.f) * ProjectileMovementComponent->InitialSpeed); ProjectileMovementComponent->Velocity.Z = -1 * ((ShootDir.Z + 380.f) * ProjectileMovementComponent->InitialSpeed);
// ProjectileMovementComponent->Velocity.Y = InitialLoc.Y;
ProjectileMovementComponent->Velocity.X = 0.f; ProjectileMovementComponent->Velocity.X = 0.f;
} }