Hey, Im new to unity but find it very interesting ^^
Ive bin struggeling with a problem for several hours now, and I can cleary see that i need some help with it.
I have a turret firing balls into my world, and when the balls hit my character(First Person Character Controller) i want the game to stop (gameover)
But i dont know how to do this.
Can anyone link me a tutorial or a script that could do this, thank you very much in advance
I could imagine something like putting a tag on the character controller.
And then tell the ball script that when i hit something with that tag the game would pause and display gameover.
But this only works when its two rigid-bodyes⌠and when I add a rigid body to my first person character controller it starts jumping around all crazy
okay i see, I got it working. but i got several balls⌠it shoots out 300 balls i have to avoid ^^ so when they touch with each other, the game ends to? how do i tell it that it must do it only when it hits the character controller and not all the other balls jumping around?
The OnCollisionEnter callback can be passed a collisionInfo struct that will contain the gameObject that collided with it. If you were using an OnCollisionEnter callback on each ball, you could check the gameObject field of the collisionInfo and see if its tag matched a tag you gave to your player.