Hallo Tebjan, Tebjan Halm hat gesagt: // Tebjan Halm wrote:
was tricky, but there is a more or less easy solution if you use two rotate objects. first rotate around the z axis with:
180/3.14159265 * atan2($f2, $f1);
then rotate the cube around its y axis with:
180/3.14159265 * (acos($f3/$f4)-3.14159265/2);
where $f4 is the length of the diff vector. the subtraction of half pi (90 degree) was found by trial and error ...
attached is the solution (i hope).
YESSS! Thank you a lot this is working perfectly as intended!
I just changed:
180/3.14159265 * (acos($f3/$f4)-3.14159265/2);
to be:
180/3.14159265 * acos($f3/$f4) - 90;
as that is a bit easier to read any maybe a little bit faster and more accurate as well.
Frank Barknecht _ ______footils.org_ __goto10.org__