- Home /
Collision between player and a ball
Hi guys,
i've a problem. I've very little experience in programming in unity, and this is my situation:
i've a simple game were now there is only a plane with a character on it. I want to add some sphere floating to him, and he can hit them, changing there direction (sorry for my english =) ).
for starting, if anybody can help me, is enough to be able to put a sphere near the character that reacts to collision with him.
tell me all about the setting about rigibody, collider and so on, i'm in your hand! =)
Thanks all!
Answer by robert 4 · Mar 04, 2011 at 03:56 PM
function OnCollisionEnter(other : Collision) {
if (other.gameObject.name == "floor1")
{ print("Game Over"); }
if (other.gameObject.name == "floor2")
{ print("Game Over1"); }
}
for managing the collision detection this is good, but first I need to know how to show the ball moving towards the player, and which settings give the player and the balls to make sure that if they bump, they change direction (the balls) ...