• News

• Industries

• Learning & Support

• Community

• Marketplace

# Best way to compare X/Y input to a 360-degree rotation?

Hi,

• I have an object (Wind) that rotates (only yaw/Z) in the world. Currently, I’m getting its rotation as -180 to +180.
• I have an object (Ship) that gets X input between -1 and 1, and Y input between -1 and 1.

What I would like to do is check how close the “direction” of my X/Y object is to the first one.

Example: If the Wind direction is 0, Ship-X is +1 and Ship-Y is 0 - The “Match” would be 1.

What is the best way to do that?
I’m having a hard time since they’re in different forms.

Thanks,

if you want to compare the direction of the two vectors, you need to do an inverse cosine calculation (ACos node) between the dot product of the two directional vectors.

Id suggest getting the forward vector of your craft, and the forward vector of your wind, and comparing them with this formula:

Good Luck.

I am not sure what you wanted, but if you wanted the angle between 2 vectors, you can always do a Dot Product (Normalise), & it will return angle between 2 vector.

NormaliseVector1 . Normalisevector2=x ("." is dot product)
AngleBetweenvectors= Cos-1(x)

All of the above operation nodes are available in blueprint.

Edit:RennJan was faster than me, haha, but we have same solution. I only saw his post asfter I posted.

Took a while for me to get back to this. That worked beautifully! Thanks a lot!