dongju.jeong Posted July 10, 2019 Share Posted July 10, 2019 quat sample = quat(lookAt(Vec3(0, 0, 0), Vec3(0, 1, 0), vec3(0, 0, 1))); sample's X_angle is -90. but I don't understand why I get value -90. I thought the operating principles of this function were as follows. ↓ and why Mat4's getAxisX() is left vector, getAxisY() is back vector?? Isn't that the opposite? Link to comment
cash-metall Posted July 11, 2019 Share Posted July 11, 2019 20 hours ago, dongju.jeong said: and why Mat4's getAxisX() is left vector, getAxisY() is back vector?? Isn't that the opposite? yes this is a mistake, will fix in the next documentation update The lockAt method has a fourth parameter — what is to be considered as a forward direction. For this method forward direction by default -Z, since lockAt is used primarily with the camera and returns the view matrix. If you want to use it to rotate a non-camera, use the four parameter AXIS_Y. or just use setDirection method 1 Link to comment
dongju.jeong Posted July 11, 2019 Author Share Posted July 11, 2019 (edited) yes, I know mean about this function's fourth paramether. but When the camera tries to look at a target of 0,1,0 from a position of 0,0,0., I still don't know why the matrix that x_axis degree is -90 is returned. For the 0,0,0camera to look at the 0,1,0target, I think the x-axis angle of the camera node should be +90. Is the third parameter the upward direction of the moment the main object is looking at the target? Or is Upward direction when it is at the origin(degree 0,0,0) before looking at the target? Edited July 11, 2019 by dongju.jeong Link to comment
cash-metall Posted July 11, 2019 Share Posted July 11, 2019 lookAt returns modelview matrix. player->setWorldTransform(inverse(lookAt(Vec3(0, 0, 0), Vec3(0, 1, 0), vec3(0, 0, 1)))); see also setTo function 2 Link to comment
dongju.jeong Posted July 15, 2019 Author Share Posted July 15, 2019 OK, I understand. thank you. Link to comment
Recommended Posts