How to include collider to a gameobject?

I am trying to hit a ball using a golf club. My golf club has three components (three game objects: handle, shaft and head as shown in the attached file gameobjects.png). Head gameobject’s inspector can be seen in the another attached image.
To hit the golf ball, we need a collider. So I put a Capsule Collider at head game object. But I don’t see any collider at head gameobject.
The head is shown in the scene image in the attached file.
Why I can’t put Capsule Collider at the object?

3218987--246658--gameobjects.png
3218987--246664--headinspector.png

Hi @NyanGoodWill welcome to the forum! :slight_smile:

To hit the golf ball, you need two colliders. One on the head (of the golf club brat) and one on the ball.

Probably is better to put a box collider with the same rotation of the head surface, if you what to use Physics to make the simulation.

“The head is shown in the scene image” is showing the yellow collider capsule is properly attached to the game object head correctly.

In any way, you also need a Rigidboady.

You need one RB (Rigidboady) for the gold club and other RB for the ball. When moving a game object, it’s imperative to add a RigidBody to it.

When you are moving colliders too fast or the colliders are to small there are cases when they do not collide. This happens because there is not instant that are colliding. Sory for my English. In one physic instant the head was going to make the collision with the ball and in the next physic instant the head passes the ball and no Collider was occluded, no collision occurred. There was not an instant that objects were colliding. To resolve this, you need to increase the physic time resolution and or make the header collider bigger.

"Fixed Timestep
Tweak the Fixed Timestep value on the Time Manager, this directly impacts the FixedUpdate() and Physics update rate. By changing this value you can try to reach a good compromise between accuracy and CPU time spent on Physics."Ricardo Aguiar

You must take into account also that the header collider can touch the ground. And you must prevent this also.

another way is just to give impulse force to the Rigidbody ball without the actual simulation of the hit.

I suggest you, take a look and follow this project tutorial: https://unity3d.com/learn/tutorials/projects/roll-ball-tutorial
And also Look for the physics video tutorial.

1 Like

Thanks @AlanMattano for good explanation.Let me explore more. I am new to Unity so your advise are useful.