So I´m learning the Unreal Engine ropes in a FPS. The problem I encounter is that my grenades often seem to ignore meshes and move through them instead of colliding, but I don´t get why. When it goes through a mesh and I stand still and “throw” exactly the same it’s consistently moving through the mesh. When I stand somewhere else and throw it can bounce normally. When I first encountered this problem I just put up a collision box behind walls to block all, but that’s combating symptoms instead of tackling the real problem.
I included a screenshot of the actor. I hope someone can help.
Couple notes on approaching this from looking at your bp picture.
Using a mesh for collision checking means its based on the collision settings of the mesh. If this is for accuracy of the model’s shape, make sure the collision is set up properly - whether it’s auto convex generated or ucx imported.
If you don’t care much for accurate collision, I would turn off the collision for the mesh in the bp. Thus makes it purely a visual element. Then use a collision component (like a sphere) as the actual collider. This makes the collision a specific reference for bp use. I go this route for flexibility.
The explosion radius component, I assume, is meant to fire off for a short moment. There is a cleaner approach here that is less work because the overlap event of a collider returns a single actor. Instead, call Sphere Overlap Actors to get an array of all actors in a spherical radius when you need to. This is not an event, it’s a function, so you can call this function on a hit event or in a timer. Then perform a for each loop on the returned array to apply damage to all actors caught in the blast area. You can also use draw debug sphere with the same settings to see how big the explosion is.
Instead of add impulse, you can add a projectile component which has reliable physics performance, even when moving fast.
Thank you for your help. I may need to invest more time on learning about collision. I took a sphere collision, made it the root. Set it up to simulate physics and collision block all. Removed collision from the grenade mesh, set the actor for the impulse to the collision sphere and that improved a lot. But still there were some places I could throw the grenade through a (only a tiny place in) wall mesh. The wall mesh has collision from convex Decomposition option in Unreal Engine and set the complexity to complex as simple. So I don’t know what the problem could be.
But now using the BP FirstPersonProjectile from the default first person package as a reference I set the grenade up as projectile that can bounce and that works without fail.
++Edit++
ConradG I’ll look into your suggestion in 3). Currently I use the ExplosionRadius with the function Get Overlapping Actors at moment of explosion to get an array like you said. I’ll revisit that later
This is already built in to the engine; something like “spawn radial damage at point” which will find all damage-able actors within radius and apply that damage.
Similarly, you can then, per actor, check the “apply impulse on damage” if you want them to move from the damage.
Good to hear. Bounce is a great feature for your grenade behavior.
If you want, post a picture of the wall and its collision that is causing the problem.
There is a continuous dynamic collision checkbox for your collider component to try. It could help, it’s for fast moving small objects, usually bullet type things. It’s not a guarantee; there might be a different problem. There are some other checkboxes in the same place to check out. Small collider objects tend to give us collision inaccuracies.
Physics is optional when using a projectile component.
Instead of impulse, use the projectile component’s initial/max speed values. I’ll typically set the same value for both.
The grenade is really small, it should be bigger for visual read which also makes it less likely to fall through things. Tiny objects are harder to precisely calculate - hence the glitching. This may also be occuring in spots between two walls, see below.
For the wall you have, you can make it a box collision from the drop down in the static mesh editor. Delete the current geometry collider before making the box. This will be cleaner. Also, using Complex as Simple ignores the collider you have. This setting is basically saying “use my model as collision data” instead of the collider. It is for vertex accurate calculations, not necessary for your needs here.