Unsolved How do I set the center of rotation of a Qt3D scene to the center of the active .obj file in the scene?
-
import QtQuick.Scene3D 2.13
import Qt3D.Core 2.13
import Qt3D.Render 2.13
import Qt3D.Input 2.13
import Qt3D.Logic 2.13
import Qt3D.Extras 2.13import QtQuick.Controls 2.5
import QtQuick.Dialogs 1.3
import QtQuick 2.5 as QQ2ApplicationWindow
{
visible: true
width: 1050
height: 780
title: qsTr("3D Viewer")
flags: Qt | Qt.Window | Qt.FramelessWindowHintheader: ToolBar { ToolButton { text: "Open 3D Model" onPressed: { fileDialog.open() } } } Scene3D { anchors.fill: parent aspects: ["input", "logic"] cameraAspectRatioMode: Scene3D.AutomaticAspectRatio Entity { id: sceneRoot Camera { id: maincamera projectionType: CameraLens.PerspectiveProjection fieldOfView: 60 aspectRatio:16.0 / 9.0 nearPlane : 0.1 farPlane : 1000.0 position: Qt.vector3d( 0.0, 0.0, 30.0 ) upVector: Qt.vector3d( 0.0, 1.0, 0.0 ) viewCenter: Qt.vector3d( 0, 0, 0 ) } FirstPersonCameraController { camera: maincamera } ObjectPicker{ id: spherePicker onPressed:{ console.log(maincamera.viewVector) } } components:[ RenderSettings { activeFrameGraph: ForwardRenderer { camera: maincamera clearColor:"#333333" } }, InputSettings { } ] PhongMaterial { id: material diffuse:"#CECECE" } TorusMesh { id: torusMesh radius:15 minorRadius:6 slices:16 rings:32 //source: "Monkey.obj" } Transform { id: torusTransform translation: Qt.vector3d(0, 0, 0) } Entity { id: torusEntity components: [ torusMesh, material, spherePicker,torusTransform] } Entity { id:pointLightEntity1 PointLight{ id:pointLight1 } Transform{ id:lightTransform1 translation:Qt.vector3d(0.0, 0.0, 30) } components:[pointLight1,lightTransform1] } Entity { id:pointLightEntity2 PointLight{ id:pointLight2 } Transform{ id:lightTransform2 translation:Qt.vector3d(0.0, 0.0, 30) } components:[pointLight2,lightTransform2] } } }
}