hi, I’m having an issue with collisions that I can’t for the life of me figure out.
basically I have a plane, and on this plane I have a box collider and a rigid body, with gravity off and iskinematic on.
I then have a script which is attached to objects this plane can collide with
function OnTriggerStay (other : Collider) {
if(other.gameObject.tag != "Door"){
var children = other.gameObject.GetComponentsInChildren (Renderer);
for (var child : Renderer in children) {
child.renderer.material.color = Color.red;
}
other.gameObject.renderer.material.color = Color.red;
}}
it basically checks for the collision then turns the plane red.
now, I want different shaped planes, and i’ve managed to add child planes to the parent and with the script above, if the parent hits something, everything turns red, however, if just the child plane hits something, only the child plane turns red. Obviously I’d like for it all to turn red.
The child planes each have a collision box, and each have a rigidbody with the same settings as the parent. If i remove the rigidbody on the clidren, none of the collisions seem to work. Any ideas how I can select the parent of the child when the child collides?
Thanks