Search code examples
javaandroidarcore

Disable drag, pinch and twist ArFragment


Is possible to fix the dimensions and the place of the objects in ArCore on Android? I want to disable the drag, pinch and twist options from the ArFragment.


Solution

  • You should consider using TransformableNode and disable scaleController, rotationController and translationController:

    val anchorNode = AnchorNode(anchor)
    val node = TransformableNode(fragment.transformationSystem)
    node.scaleController.isEnabled = false
    node.rotationController.isEnabled = false
    node.translationController.isEnabled = false
    node.renderable = renderable
    node.setParent(anchorNode)
    fragment.arSceneView.scene.addChild(anchorNode)