Reputation: 455
TransformableNode gestures are not working on the object in SceneView.
I'm displaying a 3D object on SceneView. When I provide TransformableNode as first child to the scene of SceneView then no gesture is working. But when do the same thing with ArFragment, then everything works.
private fun createNode() {
val transformationSystem = makeTransformationSystem()
val transformableNode = TransformableNode(transformationSystem).apply {
rotationController.isEnabled = true
scaleController.isEnabled = true
translationController.isEnabled = false // not support
setParent(sceneView.scene)
this.renderable = myRenderable // Build using CompletableFuture
}
sceneView.scene.addOnPeekTouchListener { hitTestResult, motionEvent ->
transformationSystem.onTouch(hitTestResult, motionEvent)
}
}
private fun makeTransformationSystem(): TransformationSystem {
val selectionVisualizer = FootprintSelectionVisualizer()
return TransformationSystem(resources.displayMetrics, selectionVisualizer)
}
I want my 3D object in SceneView can be able to rotate and scale using gestures which are used in TransformabelNode.
Upvotes: 1
Views: 996
Reputation: 26
Try calling transformableNode.select()
after you create your node (or simply call select()
in your apply block).
Upvotes: 1