Get angle between two vectors

Hello, could you tell me how I can get an angle between two vectors?
I’m making a rotation system with HingeContraint.TargetAngle. And I wanted to know the angle from the starting position, and the mouse position.

I wanted the HingeConstraint to rotate my part to the mouse direction

I don’t know if this mapping is right, I based it on what I had researching

1 Like

Read these 2 articles:

fyi |vector| means the distance of the vectors itself.

we use dot product

angle = math.acos(v1:Dot(v1) / (v1.Magnitude * v2.Magnitude))

I printed this, the printed value is not even more than 1.5

my bad I wrote it incorrectlly dot product of same two vectors isnt logical, it should be:

angle = math.acos(v1:Dot(v2) / (v1.Magnitude * v2.Magnitude))

and also please keep in mind u are getting the angle in radians.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.