#[TIP/BUG] Rocket projectile stops when overlapping self

4 messages · Page 1 of 1 (latest)

obsidian raptor
#

I found a problem with the custom movement projectile for the rocket projectile in the course. When you overlap the projectile, it does not hit the owner which is great, but it also it stops the projectile completely. When you move out of the way, the Projectile moves again. To illustrate I made a video with the projectile speed slowed to 200. I found a really simple fix - that I posted yesterday but thought I'd copy to this forum for easy access. The fix is to call IgnoreActorWhenMoving on your projectile collision box. With this fix, the custom movement component is no longer necessary which simplifies the code and fixes the bug. Enjoy!

void AProjectile::BeginPlay()
{
    Super::BeginPlay();
    
    // ...


    // Server is in charge of damage, so do hit detection there
    if (HasAuthority())
    {
        CollisionBox->OnComponentHit.AddDynamic(this, &AProjectile::OnHit);
        CollisionBox->IgnoreActorWhenMoving(Owner, true);
    }
}
lone dew
#

This sounds really interesting. And yes, I also believe, that the forum is a much better place for tips like this. Would have never found that in the chat. I never was a friend of a custom movement component for such simple stuff - thanks so much for posting to the forum.

obsidian raptor
#

Agreed. This solution worked really well!

lone dew
#

There's that term pythonic in the Python world, so in the world of Unreal i'd like to call it unrealistic 😀