I casted a ray from point B to a sphere ( The sphere aint at the origin point ).
Using the Vector3.Angle, I cant seem to find the right output. From point B, the Vector3.Angle should output 90. And if from Point A, it should Output something around 45. The problem is that it uses the originn point as reference. So how can I use an objects position as reference instead? The Vector3.Angle syntax only takes 2 parameters.
Hopefully the explanations done in plain english, I’m still learning Unity
What are you trying to find the angle between? A and B? A, B and the sphere’s tangent?
In order to get the angle between two points relative to some third point, you construct the vectors from the third point to the first and second points, and get the angle between those two vectors.
// Assume you have these points:
Vector3 pointA, pointB, referencePoint;
//You construct:
var toPointA = pointA - referencePoint;
var toPointB = pointB - referencePoint;
var angle = Vector3.Angle(toPointA, toPointB);