如何更改 TrackballControls 上的旋转轴心点但保持 camera.lookAt 位置不变?

编程入门 行业动态 更新时间:2024-10-26 11:23:51
本文介绍了如何更改 TrackballControls 上的旋转轴心点但保持 camera.lookAt 位置不变?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我需要能够改变旋转轴而不改变三点上的相机外观.TrackballControls 无论我尝试过什么,我都无法成功.请给我一个方向来解决这个问题.我真正想要实现的是像鼠标控件一样的 Revit.

I need to be able to change rotation pivot without changing camera lookAt on THREE.TrackballControls no mater what I tried I could not succeed. Please give me a direction to solve this problem. What I am actually trying to achieve is Revit like mouse controls.

推荐答案

我能够通过创建 2 个名为轨道和目标的 3D 对象,然后将目标和相机作为子对象添加到轨道中来解决这个问题......相机总是看起来在 target.position,x 轴上的 mousemove 围绕 Z 轴旋转轨道对象(因此目标和相机围绕轨道旋转),y 轴上的 mousemove 围绕 cameraSideways 方向旋转相机臂(camera.position 矢量).

I was able to solve this problem by creating 2 3D objects named orbit and target, then add target and camera into orbit as child objects... camera always looks at target.position, mousemove on x axis rotates the orbit object around Z axis (hence target and camera rotates around the orbit) and mousemove on y axis rotates the camera arm (camera.position vector) around cameraSideways direction.

这篇关于如何更改 TrackballControls 上的旋转轴心点但保持 camera.lookAt 位置不变?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-30 15:01:50,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1395734.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:轴心   如何更改   位置   TrackballControls   camera

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!