Help with ballistics optimization

So basically I have a working ballistics system from an asset with typical Parent weaponclass, baseprojectile, rifleclass and shotgunclass that player and AI share in common.

I have a basic slowmo effect with setglobaltime dilation and I wanted to add a cool particle effect simulating a matrix style bullet through the air, so I added a emmitter in the Base Projectile just where the line tracer is and attached to the Cylinder Mesh. Works very cool and looks amazing.

The problem is that with more enemies also using it it drops fps to like 10 15 which is ridiculous. So I thought it would be best if only the player has the emitter and not the enemies.

The problem is I have’nt found a way to do it without editing Base projectile itself because my gun child is just referencing the parent. Here is the nodes I added after the ray trace. Any ideas?

To achieve a particle effect only for the player’s projectiles and not for the enemies, you can use a condition to check whether the projectile is fired by the player or an enemy. Since you mentioned that your gun child is referencing the parent, you can add an additional check in your Base Projectile class to determine if it’s fired by the player or an AI. Here’s a general approach using Blueprints:

  1. Add a Variable to Base Projectile:
  • In your Base Projectile class, add a boolean variable to determine whether the projectile is fired by the player.
  1. Set the Variable in Child Blueprints:
  • In the child Blueprints (RifleClass, ShotgunClass), set this variable based on who is firing the projectile.
  1. Modify Particle Emitter Logic in Base Projectile:
  • Modify the logic in the Base Projectile class to only spawn the particle emitter if the projectile is fired by the player.Here, we’re using a branch node to check whether the projectile is fired by the player before spawning the particle emitter.

This way, the particle effect will only be spawned when the projectile is fired by the player and not by enemies. Make sure to set the “Is Player Projectile” variable appropriately in your child Blueprints.

If you have specific logic for determining whether a projectile is fired by the player or an enemy, you can adjust the conditions accordingly. This approach allows you to control the particle effect based on the type of projectile without directly modifying the Base Projectile class for each child Blueprint.

1 Like

Thanks will try that!