events - How can I check if there is a collision? -
in game, have ball , ground. ball falling , collides ground.
but how can check if ball has collided? i've added script ball, , got following code:
void oncollisionenter (collision collisioninfo) { print ("collision!"); destroy(this); }
problem nothing happens, using wrong event? want trigger animation.
your code work if using 3d colliders. however, since you're using 2d, there's separate event called oncollisionenter2d, change event this:
void oncollisionenter2d (collision2d collisioninfo) { print ("collision!"); destroy(this); }
Comments
Post a Comment