Collision surface check.

I want to check the surface in collision.

for example, cube has six surface.
so, I want to know when cube has collision which surface of cube has collision.

You could use the normal of the hit and transform that to local space. To make things easier to compare just round the returning Vector3 and then compare the output. The code below should be enough to get you started on an implementation, although it’s just tested in a very strict environment with a cube. Hope it helps!

#pragma strict

function OnCollisionEnter (collision : Collision) {
	var contact : ContactPoint = collision.contacts[0];
	var normal : Vector3 = contact.normal;
	var inverseNormal : Vector3 = transform.InverseTransformDirection(normal);
	var roundNormal : Vector3 = RoundVector3(inverseNormal);
	
	ReturnSide(roundNormal);
}

function RoundVector3 (convertThis : Vector3 ) : Vector3 {
	var x : int = Mathf.Round(convertThis.x);
	var y : int = Mathf.Round(convertThis.y);
	var z : int = Mathf.Round(convertThis.z);
	var returnVector : Vector3 = Vector3(x,y,z);
	return returnVector;
}

function ReturnSide (side : Vector3) {
	var output : String;
	switch (side) {
		case Vector3.down:
			output = "Down";
		break;
		case Vector3.up:
			output = "Up";
		break;
		case Vector3.back:
			output = "Back";
		break;
		case Vector3.forward:
			output = "Front";
		break;
		case Vector3.left:
			output = "Left";
		break;
		case Vector3.right:
			output = "Right";
		break;
	}
	Debug.Log(output+" was hit.");
}

Im pretty sure thats not possible. One way you could do it is create 6 plane colliders that side faced over each side of the cube. So each individual plane would offer different responses each cube face.