저는 qt3d에 익숙하지 않아 여러 모델을 가진 장면에서 사용자 입력을 처리해야합니다. 특히 나는 사용자가 클릭 한 모델을 찾아야합니다. mouseHandler 및 ObjectPicker를 사용해 보았지만 작동하지 않는 것 같습니다. 누군가가 모범을 보았습니까? 예를 들어Qt3d qml 사용자 입력
는 내가있는 경우 :
Entity {
Camera { id:camera ... }
FirstPersonCameraController {
camera:camera
}
components: [
RenderSetting{
activeFrameGraph:ForwardRenderer {
camera:camera
clearColor:"transparent"
},
InputSetting{}
]
MouseDevice {
id:mouse1
sensitivity:0.1
}
SphereMesh {
id:sphereMesh
radius: 3
}
PhongMaterial{
id:material
}
Entity {
id:sphere1
components: [sphereMesh,material]
MouseHandler {
sourceDevice:mouse1
onClicked: console.log("[sphere 1] clicked"
}
}
Entity {
id:sphere2
components: [sphereMesh,material]
MouseHandler {
sourceDevice:mouse1
onClicked: console.log("[sphere 2] clicked"
}
}
}
는 내가 구를 클릭하면 sphere1 또는 sphere2에 사용자가 클릭,하지만 난 모든 로그를 볼 수없는 경우를 구별 할 필요가!
몇 가지 코드를 제공해 주시겠습니까? 모델을 무엇이라고 부릅니까? 어쩌면 [MouseArea] (http://doc.qt.io/qt-5/qml-qtquick-mousearea.html) – user2436719
내 게시물을 편집 할 수 있습니다! –
나는 이것도 처음 접했지만 엔티티의 구성 요소로서'ObjectPicker'를 넣어야한다고 생각합니다. – Matt