简体   繁体   English

移动相机gluLookAt

[英]Move camera gluLookAt

With this instruction gluLookAt: 使用此指令gluLookAt:

gluLookAt( p1, p2, p3, l1, l2, l3, u1, u2, u3 );

How can I move the camera one unit to the left, keeping the direction of looking at the same point? 如何将摄像机向左移动一个单元,同时保持注视方向相同?

Apparently i cant just do p1-1, because its moving 1 in the global space, but i need to move the camera in the camera space, just with the information of the instruction above. 显然我不能做p1-1,因为它在全局空间中移动1,但是我需要在照相机空间中移动照相机,只需上面指令的信息即可。

A found in a search that i could found the right vector and do this: 在搜索中发现我可以找到正确的向量并执行以下操作:

right = u * dir (normalized)

p = p - right
l = l - right

But i cant understand why or even if this works... 但是我不明白为什么或者即使这可行...

You have to decrement p1 and l1. 您必须递减p1 l1。

p specifies the position of the eye point and l the position of the reference point. p指定眼点的位置, l指定参考点的位置。

如果要修改摄像机的位置,则应使用目标的坐标进行相同的更改。

您的问题是否与向左顺时针方向绕y轴旋转的问题相同?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM