/* Initialize fracture handlers. */ void Start() { tweenPosCount = 0; jfTex = FindObjectOfType <JumpFloodTexture>(); voronoiBounds = bounds; vf = GetComponent <VoronoiFracture>(); vf.init(voronoiBounds, fracPiece, startObjVF, piecesContainerVF, vfSites); jf = GetComponent <JumpFloodFracture>(); jf.init(jfShader, fracPiece, startObjJF, piecesContainerJF, jfSites); }
void OnCollisionEnter(Collision col) { if (col.gameObject.tag == "Projectile") { Debug.Log("Entered collision with Projectile"); //remove this game object's mesh renderer,box collider,Mesh filter and rigid body Vector3 originalPosition = transform.position; Material material = this.RemoveAllComponents(); //create two game objects of half the the width as this cube //add them as child to this cube // GameObject first = Instantiate(Resources.Load("SplitHalf 1", typeof(GameObject))) as GameObject; // GameObject second = Instantiate(Resources.Load("SplitHalf 2", typeof(GameObject))) as GameObject; DoublyConnectedEdgeList dcel = new VoronoiFracture().GetVoronoiDiagram(); CreateBodiesForEachFace(dcel, material, originalPosition); DoublyConnectedEdgeList d = null; // d.ToString();//intentional program crash for pausing } }