Angle between 3 points

Hi, do you know about a function to calculate the angle between 3 3D points?
Here my attempt: https://playground.babylonjs.com/#VV9QTA#5
Cant wrap my head about how to correctly calculate it…
Thanks

Hi CornelioD,

Babylon does have some built-in helper functions that can aid with this, but probably the easiest thing to do is calculate the direction vectors and find the angle between those, as that simplifies the vector arithmetic.

Angle between 3 points | Babylon.js Playground (babylonjs.com)

I glanced over what you were doing before; it looks like you were doing pretty much the same thing manually, and it was pretty close to the right formula. Looks like you just forgot to take the arccosine of the normalized dot product; with that added, I think the thing you had before works too.

Hope this helps, and best of luck!

3 Likes

Thanks you very much!