Jump to content

[SOLVED] lookat() function


photo

Recommended Posts

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.

image.png.9c8d98fffe68de837e4f3d6398ec0947.png

 

 

 

and why Mat4's getAxisX() is left vector, getAxisY() is back vector??

Isn't that the opposite?

image.png.6bf266a6fe3738c1d874298350e3550b.png

Link to comment
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

  • Like 1
Link to comment

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 by dongju.jeong
Link to comment
  • silent changed the title to [SOLVED] lookat() function
×
×
  • Create New...