我正在製作一個彈丸,我想要摧毀敵方物體,這將是基本浮動物體
如何獲取它,以便兩個物體在被特定演員擊中時銷燬。ue4 C++ destory on hit如果指定者演員
void APrimaryGun::NotifyHit(UPrimitiveComponent* MyComp, AActor* Other, UPrimitiveComponent* OtherComp, bool bSelfMoved, FVector HitLocation, FVector HitNormal, FVector NormalImpulse, const FHitResult& Hit)
{
if (GEngine)
{
GEngine->AddOnScreenDebugMessage(-1, 1.5, FColor::Red, "Hit");
}
Destroy();
Other->Destroy();
}
上面是我目前的情況,但是破壞了它所擊中的任何東西,這不是我想要的。
我相信它應該是一個簡單的if語句,但不確定如何寫它。
在此先感謝
感謝這正是我想要的,你知道我怎麼會在C實施破壞的網狀++而不是僅僅從級別中取出任何機會:
摘自? –
喜歡它爆炸,例如?這更像是一個動畫事物,並且您希望動畫在發生事件(如hp = 0)時觸發。 –
一位朋友設法幫助我實現它,謝謝你的所有幫助,儘管 –