gpt4 book ai didi

How to create a third person camera that follows a cube and rotates with the cube(如何创建跟随立方体并与立方体一起旋转的第三人称相机)

翻译 作者:bug小助手 更新时间:2023-10-26 22:18:16 28 4
gpt4 key购买 nike



I which to create a third person camera in Threejs which follows a cube around and rotates when the cube rotates.
Here is what I did

我要在Threejs中创建一个第三人称相机,它跟随一个立方体旋转,并在立方体旋转时旋转。这就是我所做的


function (){
camera.position.set(
box.position
);
}

It works in following box but when the box rotates it doesn't as well.

它在下面的框中工作,但当框旋转时,它就不一样了。


So please help

所以请帮帮我


I tried creating it on my own

我试着自己创造它


Here is what I did

我是这么做的


function (){
camera.position.set(
box.position
);
}

更多回答

Is the box going to be in the view of the camera and be fixed relative to the camera?

长方体是否将处于相机的视野中,并且相对于相机是固定的?

Yes I want the camera to tail the box and when the box rotates the camera rotates with it

是的,我想让相机尾随盒子,当盒子旋转时,相机也随之旋转

I release (encourage) others to answer this question (which I've +'d). I may post what I am doing on this as a question. It seems like one could have a camera in a scene within a bigger scene, and fly that sub-scene (group?) around the bigger scene. I don't think three.js is built to do that. But we can fly a sub-scene (group) within a bigger scene. And we should be able to fly the camera independently, although that's not the normal approach. I want to pursue this.

我发布(鼓励)其他人回答这个问题(我已经+‘d了)。我可能会把我正在做的事情作为一个问题发布。似乎一个人可以在一个更大的场景中的一个场景中安装一个相机,然后在更大的场景中放飞那个子场景(组?)。我不认为Three.js是为了做到这一点。但我们可以在更大的场景中放飞一个子场景(组)。我们应该能够独立飞行相机,尽管这不是正常的方法。我想继续这样做。

[added - look at 35818278 & maybe others]

[补充-看看35818278,也许还有其他人]

I don't understand

我不明白

优秀答案推荐
更多回答

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com