Design choice for collision


I am making a really simple 3D ping-pong alike game.

I have 2 players/models who look human-alike. They have arms with multiple colliders. They are placed on left and right side of the screen.

I also have a football/soccer ball. The ball has a sphere collider with bouncy material, bounciness set to 1, and a rigidbody using gravity. it pretty much bounces around in 2 dimensions for now.

The players arms are moved by the actual players.

What I am now thinking is where do I detect the collision? Attach a script to ball and act on OnTriggerEnter() or do I add CharacterControllers to the body parts and change ball’s direction,angles, rotation with OnControllerColliderHit()?

Ps. how should I go about detecting how the ball collided with arms? (CollisionFlags?). Also how (after calculation) do I “tell” the ball to go in a direction the player “indicated”?

Any advices and critiques much welcome.

The Gameobjects you want to have a collision between both have to have a type of Collider on them and one of them has to have a non-kinematic rigidbody. Then, once one Collider hits the other, OnCollisionEnter is called on both Gameobjects. If there is a script there on any of those two Gameobjects that uses this method it will be called.

Click here for the Unity OnCollisionEnter documentation