Projectiles spawning out of world bounds

EDIT: Reducing the value of LaunchSpeed solved the issue. The glimpses (graphical artifacts) combined with pausing the game and finding the spawned projectiles wayyyy off the map spurred me onto it.


For some reason, after doing the refactoring of the aiming solution, my projectiles now spawn out of bounds. Every now and then I catch a climpse of one of them like a graphical artifact while the game is running. The console gets this log entry:

LogProjectileMovement:Warning: Projectile_BP_C_1 is outside the world bounds!

This message arrives ~3 seconds after firing, on my system.

I’ve tried attaching the debugger and stepping through the fire() function (which I think is the culprit, based on logs). My function code looks like this:

void UTankAimingComponent::Fire()
{
    if (!ensure(Barrel) && !ensure(ProjectileBlueprint)) { return; }
    bool isReloaded =
        (FPlatformTime::Seconds() - LastFireTime) > ReloadTimeInSeconds;
    if (isReloaded)
    {
        // spawn a projectile at socket location on barrel  
        auto Projectile = GetWorld()->SpawnActor<AProjectile>
            (
            ProjectileBlueprint,
            Barrel->GetSocketLocation(FName("Projectile")),
            Barrel->GetSocketRotation(FName("Projectile"))
            );
        Projectile->LaunchProjectile(LaunchSpeed);
        LastFireTime = FPlatformTime::Seconds();
    }
}

I’ve tried moving the socket location on the barrel fbx file, I’ve reset to my last commit and rebuilt the solution/project 4-5 times now, and I’ve basically run out of ideas to try. Does anyone know how to figure this one out?

Privacy & Terms