On hit issues with bullets

So I just went from Line traces to actual bullets in my game and I’ve run into a few issues I’m not sure how to handle.

The On Hit event on the bullet is not always triggering when hitting another actor. It does sometimes but tend to fail frequently. I check a few other threads and they said to turn on “Simulate Generates Hit Events” on both the bullet and the Target. This didn’t help though.

Instead of actually triggering the script when the bullet hits it instead sends the target flying backwards. Where or what should I look for to prevent this? I’ve tried to change the mass of the projectile and target but I guess there’s still some kind of hidden force calculation or friction modifier I need to adjust to prevent this.

  1. First of all you need to check collision settings Collision Filtering - Unreal Engine
  2. How do you spawn a projectile?

How are you moving the bullets? Is there a projectile movement component?

The collision on both bullet and target are set to Block All.

It’s spawned like this with the aimpoint being outside of the collision capsule of the soldier fireing the bullet (with some modifiers to get some randomness to the trajectory)

And the bullet is moved with a Projectile Movement component

Simulate Generates Hit Events

This is needed when simulating physics, here the projectile movement component emulates it internally. Besides, you’re getting some hits.


not always triggering when hitting another actor.

Can you give us more details regarding the scene setup?

  • how large is the target actor?
  • are you shooting at something very thin?
  • is there anything unorthodox going on?
  • things are being moved around?
  • how does the bullet component hierarchy look like?

I’ve just tested it with the velocities you have punched in and got 100 out of 100 hits against a static wall.


Instead of actually triggering the script when the bullet hits it instead sends the target flying backwards. Where or what should I look for to prevent this? I’ve tried to change the mass of the projectile and target but I guess there’s still some kind of hidden force calculation or friction modifier I need to adjust to prevent this.

You probably have Simulate Physics ticked on the root component of the bullet actor. No need if we’re using a projectile movement component. Now, thinking about the above, I’m almost certain those issues are caused by trying to simulated physics and using the projectile component simultaneously:

image

By default, the physics sim is not using CCD - at those velocities, without the component’s aid, you will get inconsistent results.

1 Like

The target (an enemy soldier) is about 1.8m tall and got a capsule with a radius of 34. So more or less like your avrage Unreal manequin.

Nothing unorthodox going on. Enemy soliders approch friendly soldiers. Detects them, stop and shoot. Bullet spawn, travel and hit. Friendly fire can occur but shouldn’t give a different result.

I guess this is the bullet hierarchy
image

Simulate Physics is not checked on neither Bullet nor Soldier.
Soldier
image
Bullet
image

The component hierarchy is not right. Place the collision at the root - drag it there. Something along the lines of:

image

Simulate Physics is not checked on neither Bullet nor Soldier.

Ensure it’s not checked on whatever serves as the root.

So something like this?
image

And Simulate physics is not checked.

I don’t see any change though.

Nah, drag the Collision onto the DefaultSceneRoot. You want the collision as the root - that’s the only thing the projectile movement cares about.

Cheers! That seem to have fixed the issue.
It messes up the look of the projectile though…and I have to find the option for bouncing again :smiley:
But that’s another issue.

1 Like

Perhaps it’s just this:

It messes up the look of the projectile though

Other than that, consider expanding on what that means.

Bouncing fixed.

Now I think it’s the size of the bullet that messes things up.
The visual looks of it got squished and it keeps getting stuck in the soldier shooting it, so they kill themselves. So need to tweak the size and see if that helps.

Check the scale of the bullet mesh component (it can get messed up when reparenting comps). And disable collision on the bullet mesh - it does not need any.

The visual looks of it got squished

Also check the Aim Point scale since you’re using its transform - who knows what scale we’re feeding the actor.

and it keeps getting stuck in the soldier shooting it,

Here’s where the collision filtering comes in handy. Or perhaps it’s enough to offset the Aim Point a bit more so the Collision does not catch the gun / player capsule.

It was the mesh collision that made the soldiers hit them selves.
And the scale of the projectile is starting to shape up as well.
The aim point is mearly rotating an arrow so shouldn’t affect anything except for the initial vector of the bullet.

Thank you for your help! :slight_smile:

1 Like