So here’s my issue
I need to detect when 2 or possibly more rigidbodies are touching so when I click on them they destroy based on their IDs
My code works just fine if I click on them during the time of interaction before they come to a rest, but once they stop moving and enter a rest state the contact is no longer being recognized.
Here’s the code and mind that I have tried changing it to a OnCollisionStay with no avail.
function OnCollisionEnter(col:Collision) {
myHit = new Array();
for (var i=0;i<myStage.bubs.length;i++) {
var goodFind:boolean =true;
if (myStage.bubs*==null) {*
-
goodFind=false;*
- }*
- if (goodFind) {*
- var goodHit:boolean =false;*
- var thisBub:BlockControl;*
_ thisBub = myStage.bubs*.GetComponent(BlockControl);_
_ if (thisBub.myType==myType) {_
_ if (col.gameObject == myStage.bubs) {
goodHit=true;
myHit.push(i);
}
}
}
}
}
the myHit array is just storing positions in an array of the other gameobjects to know which to destroy
the myType is just to make sure they are matching colors.
I’ve been at this for a while and am probably just not seeing something simple and stupid any help is welcome.
Thanks in advance,
-Ron*_