Explosion cannot exert force to rigidbody

wuyan

Member
1,When the grenade explodes, it cannot exert force to the surrounding rigidbodies. Or keep a tiny force forever.No matter how I change the values of m_ImpactForce and m_ImpactForceFrames. The results all the same.
1612378961502.png

2,If m_ExplodeOnEnable ture,the explosion can exert the correct force on the surrounding rigidbody. But there will be new error!
Unable to pool FragGrenadeExplosion6(Clone) (instance -29540): the GameObject was not instantiated with ObjectPool.Instantiate.
UnityEngine.Debug:LogError (object)
Opsive.Shared.Game.ObjectPoolBase:DestroyInternal (UnityEngine.GameObject)
Opsive.Shared.Game.ObjectPoolBase:Destroy (UnityEngine.GameObject)
Opsive.UltimateCharacterController.Objects.Explosion:Destroy () (at Assets/Opsive/UltimateCharacterController/Scripts/Objects/Explosion.cs:223)
Opsive.Shared.Game.ScheduledEvent:Invoke ()
Opsive.Shared.Game.SchedulerBase:Invoke (Opsive.Shared.Game.ScheduledEventBase,int)
Opsive.Shared.Game.SchedulerBase:Update ()


3, Third person controller 2.2.8 Added support for HDRP (requires Unity 2020.2).
What does this mean? Where is the support? I didn't find any support pack after the update. The hdrp compatible package is not seen on TPC download page, Only one UCC download page.
 
Last edited:
1. Tested in the demo scene and it seems fine to me - check that the mass of your rigidbodies isn't too high.
2. Haven't seen this error with Explosion before - are you able to reproduce this in the demo scene?
3. The HDRP integration you're referring to is specifically for the first person arms and items, as explained on this page: https://opsive.com/support/document...oller/camera/high-definition-render-pipeline/
Hi Andrew,

1. Please look at the screenshot,I test with this box in the demo scene. In order to test the effect, I changed mass to 1.
1612443209668.png
1) First, as you said, reducing the mass can work. But there is another problem. The mass is too small. Once the bullet, arrow, character and other rigidbodies touch it, it will be hit fly several meters away. But the explosion just pushed it away a little bit. This is unreasonable. In any case, need to give different impact force to different explosions.

2)So, look at the screenshot below. I adjust the value of the impact force variable in the explosive prefab of the grenade.But no matter how to adjust the value of these two variables, it will not have any effect. Whether it's 5 or 20000, the effect is the same.
1612444969006.png

2. If the "Explode On Enable" toggle is true, all the mechanical work will be correct. All the above problems will not exist. Adjust the values of the above two variables and you will also see the expected effect change. But then there will be the errors I said yesterday.

3. OK.

4. New bug. If the impact of the explosion makes the box fly out quickly, the box will pass through the wall.

5. I'll be hurt by the explosion of a grenade when I'm hiding behind a wall. How to prevent explosion damage from passing through the bunker.
 
Last edited:
I believe that object pooling error may be a bug in fact. @Justin might know more though.

The boxes flying through a wall is just a result of the physics engine not updating often enough or interpolating. You can try using "Continuous" collision detection on the rigidbody to help this (be aware that this will affect performance if you have a lot of rigidbodies using it), or check your project's physics settings (there are plenty of guides online about this).

The Explosion component has the "line of sight" property which should force line of sight to be required before damaging an object.
 
Can you tell me how to reproduce the object pooling error within the demo scene?
 
Thanks - I'll have that fixed in the next update. This problem exists because the object pooler is creating the objects at the start and immediately destroying them. However, with Explode on Enable it is also trying to destroy the same object.
 
Thanks - I'll have that fixed in the next update. This problem exists because the object pooler is creating the objects at the start and immediately destroying them. However, with Explode on Enable it is also trying to destroy the same object.
Hi Thanks. Please look at the Second question above.

2)So, look at the screenshot below. I adjust the value of the impact force variable in the explosive prefab of the grenade.But no matter how to adjust the value of these two variables, it will not have any effect. Whether it's 5 or 20000, the effect is the same.
 
The Impact Force Frames is only applied to the hit objects which have the Health component. At the bottom of Explosion.Explode you can see that there are a few different conditions which will call other objects before it calls the Rigidbody's AddExplosionForce. One of the ways to debug this is to place a breakpoint within Explosion.Explode.
 
Thanks - I'll have that fixed in the next update. This problem exists because the object pooler is creating the objects at the start and immediately destroying them. However, with Explode on Enable it is also trying to destroy the same object.
I have also this bug.
 
Top