So I have these spheres called particles in my script and they have colliders on them and everything but nothing seems to be actually colliding and nothing appears in the debug log. any ideas?
var numberofpartices= 10;
var particles: Transform;
var seperation= Random.Range (-10,10);
var particlemaxsize=5;
function Start () {
for (var i : int = 0;i < numberofpartices; i++) {
var numRandom: int = (Random.Range(0,10)+.5);
var particleMade= Instantiate (particles, Vector3(i*seperation, 0, i*seperation), Quaternion.identity);
particleMade.transform.localScale= Vector3.one *numRandom;
}
}
function OnCollisionEnter(collider : Collision){
Debug.Log ("ahhhh");
}
There is a section about halfway down the Physics page which defines, with a matrix, when messages will be sent. The section is titled "Collision action matrix". You're probably not working with rigidbodies. True?
One thing you could do is under the mesh Collider you can check off "Is Trigger" and if you wanna make it do something when it collides with one object in particular you can add a tag to the object that you want to check collision with.
Java
function OnTriggerEnter(collisionInfo : Collider){
if(collisionInfo.gameObject.tag == "TAG HERE"){
Debug.Log("I just got hit! :O");
}
}
If you want them to bounce off each other then you can use:
function OnTriggerEnter(collisionInfo : Collider){
Debug.Log("I just got hit! :O");
}