CollisionFlags.Sides not registering

When an object under the control of this script runs flat into a wall, say a box with no rotation (clearly a side collision), the hit does not register. You can rotate the obstacle and sometimes the collision will register, maybe when moving backwards, but not in the simple case of a direct head-on collision. Putting rigidbodies on one or both objects does not help. What gives? I need to be able to detect these.

var cc : CharacterController;
var moveDir = Vector3.zero;
var speed = 10.0;
var grav = 20.0;

@script RequireComponent(CharacterController)
@script RequireComponent(AudioSource)

function Awake()
{
	cc = GetComponentInChildren(CharacterController);
}

function Update() 
{
	if (cc.isGrounded) 
	{
		moveDir = transform.forward * Input.GetAxis("Vertical") * speed;
	}
    if( cc.collisionFlags == cc.collisionFlags  CollisionFlags.Sides ){
		audio.Play();
    }

	moveDir.y -= grav * Time.deltaTime;
	
	cc.Move(moveDir * Time.deltaTime);
}

Even i am also facing the same problem “Dougxing”.
But i tried to detect the collision in other editor on some other computer and it was working fine but when i switched over that code to my computer surprisingly it isn’t working.
Actually i want to get that object with which my CharacterController is colliding with. I am able to get other colliders by “hit.gameObject.tag” but not in the case of another characterController.

Does anybody have any solution to this?

Try this instead:

    if( cc.collisionFlags  CollisionFlags.Sides != 0)

The code you pasted above will only work when ONLY the sides are being collided with. In other words, if the object is also touching the ground or ceiling the sound won’t play.