I'm trying to get my fps player to respawn. i think i can have this fixed easy by having the dead rigidbody ignore the collision with my still existing real body. but this code doesn't work. it keeps giving me a "Ignore collision failed. Both colliders need to be activated when calling this IgnoreCollision" error.
var dead : Transform = Instantiate(deadReplacement, transform.position, transform.rotation);
Physics.IgnoreCollision(deadReplacement.collider, transform.root.collider);
2 Answers
2
This error is pretty explicit.
Either transform.root's collider is not enabled or dead's collider is not enabled.
Since you just Instatiated the prefab deadReplacement, you should check that deadReplacement's collider is enabled.
Otherwise it's your transform.root's collider. You should check that it is enabled.
A simple way to check which is the problem if you can't tell by looking at them would be to print to the log
Debug.Log("deadReplacement " + deadReplacement.collider.enabled);
Debug.Log("dead " + dead.collider.enabled);
Debug.Log("transform.root " + transform.root.collider.enabled);
Physics.IgnoreCollision(dead.collider, transform.root.collider);
not
Physics.IgnoreCollision(deadReplacement.collider, transform.root.collider);
This isn't an answer to the question. You should delete this answer and edit the original question with this change.
– anon16733337