How to compare approximate rotations

I’m trying to check a collision rotation to find what face of an object is being hit. I’m using transform.up, transform.forward, and that works.

	// Handles object collision with Cube.
	void OnCollisionEnter(Collision collision)
	{
		// Creates a direction we have been hit from.
		Vector3 normal = collision.contacts[0].normal;
	
		// Checks whether object is valid and whether it's already been used. Returns true if okay.
		if(collision.collider.GetComponent<FallingObject>().CheckAndDestroy())
		{
			// Checks to see if collider was Moon.
			if(normal == transform.forward)
			{

I need to check if it’s within a certain range of the rotation, not the exact number. If it was vector distance I’d know, but I don’t know how to measure the difference between two rotations.

Can anyone give me advice please?

You could use the forward direction vector from each rotation and check the angle between the two.

Learn to work with dot products.
http://docs.unity3d.com/Documentation/Manual/UnderstandingVectorArithmetic.html

I noticed from your last post you express tough love lol :P. I studied for a few hours and understood that I needed the dot product ‘Vector3.Dot()’. Multiplying two vectors together to normalise them and using the Cosine between the two to find a scaler between the two. 1.0 being the same direction, 0.0 being adjacent, and -1.0 being the opposite…

From that I actually found the correct answer myself. Thanks Jessy. I’m a fan of learning myself so long as I’m given some guidance in the right direction of where to look.

You must learn the ways of the force… - Obi-Wan

http://www.youtube.com/watch?v=9OqRUErFDiU

Man, I don’t know what you guys are talking about! I just thought Unity provided a really good introduction to what you were asking about in their documentation. :expressionless:

me? if so, i just think your answer was good; simple …and still goes deep to the point without giving straight (copypaste) solution.

Slowly going off-topic, but agreed lol.

Thanks guys.