- Home /
Question by
Aldwoni_legacy · May 06, 2011 at 09:42 AM ·
objectsmultiplecollide
object collides with multiple objects?
I have one Object who falls down. Under him there are two other objects. How can I make it that for both objects, only the first time he hits them, a script is executed?
How do I make sure he only collides with whats under him and not at the sides?
Comment
Best Answer
Answer by Dreamer · May 06, 2011 at 09:55 AM
var colliding_obj;
function OnCollisionEnter(collision : Collision) {
if(colliding_obj==null) colliding_obj=collision;
else if(colliding_obj==collision ){
//execute the script of first object collides
} }
After that, just set colliding_obj=null; at appropriate time.
does this work with multiple collides at the same time?