How can I set the correct rotation for bullet impacts?

Hey guys, I have a complete set of bullet impact effects and I have them working very well with a line trace. They always spawn when I shoot an object, However, sometimes the impacts will not appear correctly. Sometimes when I shoot an object, a wall for example, the particle effect will spawn out the other side of the wall that is facing away from me. And shooting boxes normally allows for 1 to 2 sides that allow for correct rotation of these effects, but the rest of the sides make the emitter spawn inward and the effect is lost within the cube. Is there a way to perhaps get the rotation of the face that I am shooting and always force the emitter to spawn correctly? Thanks a lot!

it depends on how you’re creating your bullets. if you’re using a line trace, then break the struct of the ‘hit’ value returned from the line trace, and you can use hit normal to build a rotator. if you’re using projectiles that spawn and impact (for slower projectiles), you’ll need to get hit event and break out the struct with the hit info for the hit normal. if you are spawning projectiles for a bullet, this might not be the best approach performance wise, but be sure to use continuous collision detection if you need to use this approach for whatever reason.

1 Like

So I have used this make rot from XY and its working rather well for the most part. However, sometimes, depending on the emitter, it will still spawn the emitter out of the wrong side of the object. Below I have attached a picture of the error that I am getting where the emitter spawns on the wrong side and my blueprint for the spawning of the emitter itself. As you can see, I could not get an action shot, but the dirt has appeared on the left side of the cube after I had shot the right side.

if this behavior only occurs with certain emitters, you may want to check your emitter’s properties in terms of the actual spawning direction of the particles, initial velocity, etc.

alternatively, instead of using the impact hit data, you could also test against a different vector like the trajectory of the bullet trace. so impact location would be the same, but for rotation, just use your bullet trajectory mirrored or something. in theory, hit normal should be the same as bullet trajectory, but if you’re getting odd results here, it doesn’t hurt to test against the bullet trajectory anyhow.

Alright! Thanks so much for the help! I have simply decided that it may be the emitter, so I will simply use different ones. It worked great otherwise!