Destroy Object When Rotation is Equal To Another Objects Rotation

Hey Forum,

I am trying to create a script that destroys a game object once it’s rotation values equals a value within a 10 degree range. For instance, I want a cube to be destroyed once it’s X,Y,Z Rotation is within 10 degrees of another Cubes rotation values. I’m pretty new to scripting, and am having some trouble writing this out, any help would be much appreciated. Thank you!

  • Alan
if (Quaternion.Angle(object1.transform.rotation, object2.transform.rotation) < 10.0) {

–Eric