旋转走向在OpenGL路径 [英] Rotating Towards Path in OpenGL
本文介绍了旋转走向在OpenGL路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有关于如何旋转,在三维空间的物体麻烦,基于OpenGL旋转功能glRotatef(..)。
I am having trouble on how to rotate an object in 3D space, based on the OpenGL rotate function glRotatef(..).
glRotatef ( angle , x , y , z )
我的目的是从一个点到另一个在3D空间中行进。我想我的目的是在它移动的方向旋转。
My object is traveling from one point to another in 3D space. I want my object to rotate in the direction it is traveling.
我怎么会找角度,X,Y,Z所需要的glRotatef(...)函数,如果我知道我开始的点,在那里我完成点。
How would I find the angle, x, y, z that is needed for the glRotatef(...) function if I know the point where I am starting and the point where I am finishing.
推荐答案
在 gluLookAt
功能完全你需要在这里。这将节省您手工计算轴和角度。
The gluLookAt
function is exactly what you need here. It will save you from calculating the axis and angle manually.
这篇关于旋转走向在OpenGL路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文