Hi folks. I’ve just gotten collision detection working for the trains in my game. When a train realizes it has bumped into another train, it turns around. I’m not using any physics. I’ve got three questions for you all:
-
In my testing, when two trains collide, they both turn around, as they should. But I’m worried I’ve just gotten lucky. Since each train detects the crash independently, is it possible that the first train detects the collision, turns and moves, and thus when the second train checks for a collision, it isn’t found, since the first train has already moved away? Or is the collision reported to both parties as soon as it registers?
-
I’d like colliding trains to spawn a small crash/flying-debris animation. I don’t want both trains to spawn a crash, but the obvious solution would do just that. Is there a natural way to spawn just one? I realize I could index the trains and have the smaller-indexed train handle the crash animations, but I was hoping there might be a cleaner approach.
-
My trains are basically empty game objects containing a health bar, a train script, and the model of the train. Currently the model has the rigidbody and collider on in, and a script whose sole purpose is to tell the main script that a collision has happened. Is this a reasonable way to handle things? It seems a little clunky, but I’m new to all this stuff.
Thanks very much in advance!