Quantcast
Channel: Questions in topic: "contact"
Viewing all articles
Browse latest Browse all 75

Returned string values of thisCollider.name and otherCollider.name swap

$
0
0
The returned string values of thisCollider.name and otherCollider.name swap with each other in a seemingly random and inconsistent manner. I have a simple set up. I have a character that consists of a parent GameObject with a rigidbody and a controller script component attached, a child GameObject with a collider component for the feet and a second child GameObject with a collider component for the body. Neither of the children have rigidbody components. There is a completely separate floor GameObject with a collider component, again this does not have a rigidbody component as it is not necessary. The parent GameObject is named "Parent" The child feet GameObject is named "Feet" The child body GameObject is named "Body" The completely separate floor GameObject is name "Floor" The following script is attached to the parent GameObject: function OnCollisionEnter(theCollision : Collision) { Debug.Log("The parent object's name is ... " + gameObject.name); for (var contact : ContactPoint in theCollision.contacts) { Debug.Log("A collider on a child gameobject named" + contact.thisCollider.name + " has hit a collider on a separate, completely non-related gameobject named " + contact.otherCollider.name); } } When the character is standing on the floor, jumps into the air and land onto the floor again, sometimes the Debug.Log reports the following: A collider on a child gameobject named **Feet** has hit a collider on a separate, completely non-related gameobject named **Floor** But sometimes it reports the following: A collider on a child gameobject named **Floor** has hit a collider on a separate, completely non-related gameobject named **Feet** It seems to swap thisCollider.name and otherCollider.name with each other in a seemingly random and inconsistent manner. Anyone know what might cause this to happen?

Viewing all articles
Browse latest Browse all 75

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>