Angles between two points



in order to connect the two boxes with the spring (like in the image), i need to know the angles between the points of location of the boxes (rotation along x, y, and z so i can rotate the spring along these axes);

say v1 is the position of one box, and v2 is of the second.
there is a function v1.angleBetween(v2), where v1 and v2 are vectors, and i get a float out of that.
what does it represent (on what axis is the angle?) and how can i use it to rotate my pretty spring? :)
or should i do it in another way?

try to use spring.lookAt(target), the spring must be correctly rotated first tho.

i already tried it and it does not work right… probably because the spring's origin is on the top and not center?

ok, managed  :smiley:

lookAt() did the work eventually…

For reference, it isn't actually possible to take the angle between two points (no such thing). anglebetween returns the angle between two lines. For example in the picture you might use the angle between the line v1v2 and the x axis.