Вопрос

I have a viewport3d with a camera and some blocks inside of it. Currently using the keyboard to move the camera up/down/left/right/rotate ect.

but instead of the camera i want to move the world view. So when a user presses the W key to move up, its not just moving the camera in a +x position. As the user maybe at a 20 degree view.

Это было полезно?

Решение

Create a virtual Camera Boom.

Create an invisible object like a TDummy, in the same location as the object of interest or the center of the scene.

Create the TCamera as a child of the object. Set its position the desired distance away on one of the axes.

you can now rotate the camera around the object simply by changing the rotationAngle of the dummy object. The camera will maintain the exact distance and automatically points directly toward the center.

Also by adding light as a child of the camera it too will follow as the camera moves. Hope this helps someone.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top