How would I find the angle between two vector3s?
RubenKan explained how to get the direction between two vectors, but if you're actually looking for the angle between them you want the dot product.
local function angleBetween(a, b) return math.acos(a:Dot(b) / (a.magnitude * b.magnitude)); end;
Keep in mind this angle will be between 0 and 180 degrees.
According to this example, I created a function for you that calculates the angle (in degrees) between two Vector3
variables.
-- Returns angle between two vectors (in degrees) function angleBetween(v1, v2) return math.deg(math.acos(v1:Dot(v2)/(v1.Magnitude*v2.Magnitude))) end -- Use like this local angle = angleBetween(Vector3.new(2,9,-3), Vector3.new(-3,-4,8)) print(angle)