Irin
1
Alright, i have multiple colliders placed over my airplane object/model. The Airplane model has a rigid body attached to it so it can use the built in Unity aeroplane scripts. Each collider is housed in a Empty Game Object and it has Child_Health_Script. All colliders are housed under an Empty Game Object where the Parent_Health_Script is housed. Each impact from a rigidbody projectile to a collider calls the OnCollisionEnter() and deducts 20 points from overall health. The script works i tested it with a smaller scenareo. However, when i used it with a rigidbody on the main model/object the collisions are not being registered. Note, both the projectile and the rigidbody on the model/object are both set to ContiniousDynamic collision detection. How do i have the colliders detect the collision from the impact and why is the rigidbody sandbagging them?
Irin
2
Figured it out…kinda, so multiple colliders combined with a rigid body make compound colliders. As such, the main collision detection is done by the rigid body with the multiple colliders reporting to the rigid body. So there is no need to have a parent health script with children health script on colliders unless you are using just colliders. You can attach a single health script with just OnCollisionEnter() and place it with the rigid body. PROBLEM!: Well as it turns out if you go with the new method, the entire object falls through the ground, regardless of what collider is being used by the ground, primitive or mesh. Now what could be causing this issue?
Irin
3
Thanks to everyone who replied, i figured out what the problem was a few weeks ago. Its not issue with Unity like i though it was a line of code in my OnCllisionEnter(), this line in particular, Destroy(Bullet_col.other); ← this line actually destroyed the collider of what ever object my player character collided with.