We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Pretty much what title says. I have a bunch of boxes and I want them to face a point(x, y, z) or mouse. How do I achieve that? I've been try with atan2 function, but i only got it working for 2nd quadrant and 3rd quadrant. Here is my function:
float[] atan3(float x, float y, float z) {
return new float[]{
(float)Math.atan2(y - this.y, x - this.x) , // z axis
(float)Math.atan2(z - this.z, x - this.x) // y axis
};
It accepts x, y, z of a point to face.
Answers
Not a solution, just an alternative to your method above: :ar!
Try this trick, perhaps: