Projectile Shooting Problem

When I am moving the tank, I cannot shoot a projectile in the same direction the tank is moving. The tank’s turret only has 180 degrees of rotation that it can shoot from. Also, when I tried to shoot a projectile in the same direction the tank is moving, nothing temporary shows up in the world outliner.

This is a known issue due to the way movement is done (no physics) so the velocity isn’t taken into account when spawning the projectile.

Is there a way to fix this issue?

You can set the projectile to ignore the actor using UPrimitiveComponent::IgnoreActorWhenMoving on the collision component for the projectile. You just need to call that after you spawn it.

Sorry, I’m still a bit confused as to what to do.

Consider this a challenge:

  1. In AProjectileBase create a public function IgnoreWhenMoving that takes an AActor* (alternatively IgnoreOwner that takes 0 arguments but that must be called after SetOwner
  2. Have that function call IgnoreActorWhenMoving on the static mesh component with the passed in value (or GetOwner() with the alternative approach)
  3. Call the function you made in 1. after spawning the projectile
3 Likes

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms