A worked example, rendered from real sample data. Sign in to run the tool on your own input.
distance 0,0 3,4
normalize 3,4
dot 1,0 0,1
lerp 0,0 10,10 0.5
angle 1,0 0,1
magnitude 5,12distance 0,0 3,4
formula |b − a| = √Σ(bᵢ − aᵢ)²
= 5.0000
normalize 3,4
formula â = a / |a|
= (0.6000, 0.8000)
dot 1,0 0,1
formula a·b = Σ aᵢbᵢ = |a||b|cosθ
= 0.0000
lerp 0,0 10,10 0.5
formula lerp(a, b, t) = a + (b − a)·t
= (5.0000, 5.0000)
angle 1,0 0,1
formula θ = acos( a·b / (|a||b|) )
= 90.00°
note 1.5708 rad
magnitude 5,12
formula |a| = √Σ aᵢ²
= 13.0000
C# (Unity)
float d = Vector3.Distance(a, b);
Vector3 n = a.normalized;
float d = Vector3.Dot(a, b);
Vector3 p = Vector3.Lerp(a, b, t);
float deg = Vector3.Angle(a, b);
float m = a.magnitude;
Calculate vectors, distances, dot products, lerp, and common game math operations. Part of the DevTools Surf developer suite. Browse more tools in the Game Dev collection.