Log in or register to post comments

Unity Marker Collisions

April 23, 2014 - 9:40pm #1

Hi, im trying to do the following thing: i have 2 markers, each one has a rigidbody to create a collision, and when they collide im hiding the 3D models associated to each marker, and what i need is to create/generate a new model that represent the union of the 2 markers, im using JavaScript and im going to paste it here, can anybody help me.

 

My Code is:

var obj1:GameObject;
var obj2:GameObject;
var obj3:GameObject;

function Start(){
obj1=GameObject.FindWithTag("pupila"); 
obj2=GameObject.FindWithTag("cristalino");
obj3=GameObject.FindWithTag("UNION_1");  //This is the 3D model and is child of a ImageTarget PreFab
}

function OnCollisionEnter(Colision : Collision){
if(Colision.gameObject.name == "colisionPupila" || Colision.gameObject.name == "colisionCristalino"){
Debug.Log("Union1");
obj1.SetActiveRecursively(false);
obj2.SetActiveRecursively(false);
obj3.active = true; // i dont know how to show this model when the markers collide
}
}

function OnCollisionExit(Colision : Collision){
Debug.Log("Nada");
obj1.SetActiveRecursively(true);
obj2.SetActiveRecursively(true);
obj6.active = false;
}

 

Log in or register to post comments