How to compare two rotations?

I need to return a float value that tells me just how much alike two rotations are. In other words: How accurate they are to each other.

For example: If both rotations are exactly the same, then the max float value will be returned. If both rotations are the exact opposite of one another, then the min float value will be returned. If rotator A is just a little different from rotator B, then the float value will return just a little below the max value. Etc.

Thanks in advance. ^^

Yes! That’s perfect! Thank you so much!

if my math is right this code should return something from 0 to 1 where 0 is opposite rotation and 1 is exactly the same rotation, you need low result for equal and high result for different, just do 1-result of the division, it will do what you want, hope it helps. Try this:

6 Likes

Sorry… perhaps a stupid question, but is this input to the numerator here a ‘dot product’? When I’m trying this it says ‘dot’ but I’m not sure what else it should be…

2 Likes

Thanks a lot for this. Worked like a charm, I only needed to add +0.5 since it would result -0.5 to positive 0.5.

That’s right! It is about scalar product of two vectors.