angle bewteen two angles

i just tryed Vector3.Angle(transform.forward, new Vector3(0,y ,z )));

now it gives me the angle but not if its positive or negative.

will i have to use a dot product to get the results that i need.

is there any code that will convert a vector3 to euler angles?

Vector3.Cross (wikipedia)

can be nicely used to detect all needed directions with correct usage. for example, crossing chopper’s up and gun’s forward, you’ll got a zero-vector as result when gun is to horizon, and some value if not. value will be different if gun looks down or up.


this can be used for not so complex check. for example, projecting gun’s forward to chopper’s up will return you vector directed to up or down from chopper at will tell you does gun looks upper or lower then horizon. project gun’s forward to chopper’s right and get a left-right component


really cool tool.


will return you a vector3 of gun direction in chopper’s coordinates. so, vector3(0.1,-0.1,1) shows you that gun looks a little down and a little to right from chopper’s forward independent of chopper’s position or direction