I have red vector navAgent.transform.forward I have destination point. How do i get X angle ?
I tried Unity - Scripting API: Vector3.Angle
It doesn’t work for some strange reason… what is the mistake ?


I have red vector navAgent.transform.forward I have destination point. How do i get X angle ?
I tried Unity - Scripting API: Vector3.Angle
It doesn’t work for some strange reason… what is the mistake ?


Pretty sure that’s what you want.
The most obvious thing is this would only be correct if transform was identical to navAgent.transform… is that your problem?
nope. I still got an error.
Vector3.Angle(targetDir, navAgent.transform.forward);
Angle is not recognized as a method…
https://docs.unity3d.com/ScriptReference/Vector3.Angle.html
Did you make your OWN Vector3? If so, disambiguate by specifying the UnityEngine one explicitly.
ALSO, please specify that you have compiler error. That changes the problem from “It doesn’t work for some strange reason” to “I have an X error in my code.”:
The important parts of an error message are:
All of that information is in the actual error message and you must pay attention to it. Learn how to identify it instantly so you don’t have to stop your progress and fiddle around with the forum.
Assets\Scripts\NavigateMan.cs(92,31): error CS1061: ‘object’ does not contain a definition for ‘Angle’ and no accessible extension method ‘Angle’ accepting a first argument of type ‘object’ could be found (are you missing a using directive or an assembly reference?)

7119058–849829–NavigateMan.cs (6.42 KB)
What is the possible meaning of private object Vector3; on line 13?
As I suggested, you defined your own Vector3. Don’t do that unless you know what you’re doing.
ALSO: don’t use object type variables unless you really know what you’re doing. Enjoy the benefits of C# typechecking.
yep, my IDE played a trick on me. for some reason at some stage rider add this definition ![]()
kinda stupid ![]()
Oh Rider… sigh. That Jet-For-Brains piece of program broke our build at least once a week by silently including assemblies that didn’t exist on iOS/Android, and then the engineers would commit the changes and they’d blow up the build.
And it turned out to be SUPER tricky to actually turn that feature off… at the time it required multiple changes to multiple places, and even then sometimes it silently came back on. Maddening…