摇摆/摆动相机
我已经在互联网上搜索了一段时间,没有找到解决方案。我想知道的是如何在 OpenGL(或 DirectX)中的 3D 相机中实现摆动/摆动运动,就像您在 Minecraft、使命召唤等中找到的那样。我尝试了摆线,但它们工作时我无法获得方向才能正常工作。
I have been searching on the internet for a while now, for a solution with nothing. What I want to know is how to implement a swing/bobbing motion in a 3D Camera in OpenGL(or DirectX) like you find in Minecraft, Call of Duty, etc. I tried cycloids, while they work I can't get the direction to work correctly.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于下面的事情你有什么看法呢。
cam_pos
、cam_dest
、cam_up
。cam_right
计算为 cross (cam_pos
,cam_up
)camera_time
(如果步行,camera_time + = delta_time;
)offset_factor = sin(camera_time);
然后您可以调用
gluLookAt
或类似函数,如下所示。这将使相机从右向左摆动。您可以通过一些调整为
cam_up
矢量添加相同的内容。What do you think about the following.
cam_pos
,cam_dest
,cam_up
as usual.cam_right
as cross (cam_pos
,cam_up
)camera_time
(if walking,camera_time += delta_time;
)offset_factor = sin(camera_time);
Then you can call
gluLookAt
or similar function as follows.This will make the camera swing from right to left. You can add the same for the
cam_up
vector with some tweaking.