I’ve been reading around for hours now and I can’t figure this out. I’ve got an asteroid with a kinematic rigid body and a circle collider. I’ve got a ship that rotates, upon pressing space, it creates a Laser(Clone). The laser is a prefab, which also has a kinematic rigid body and a primitive collider. In the asteroids script, I have this:
function OnCollisionEnter2D(hitbylaser : Collision2D){
if(hitbylaser.gameObject.name == "Laser"){
Debug.Log("hit");
}
I’ve tried changing “Laser” to “Laser(Clone)” but that doesn’t work. This is kind of the most important aspect of the game too. Right now I just want the log to tell me it hit. When it does I’ll add the explosion and destruction of the asteroid.