Skip to content

Instantly share code, notes, and snippets.

@shibuiwilliam
Created February 16, 2020 05:19
Show Gist options
  • Save shibuiwilliam/5d4941c317efcad60ba5443a34c93862 to your computer and use it in GitHub Desktop.
Save shibuiwilliam/5d4941c317efcad60ba5443a34c93862 to your computer and use it in GitHub Desktop.
private fun placeAnchor(hitResult: HitResult,
renderable: Renderable){
val anchor = hitResult.createAnchor()
placedAnchors.add(anchor)
val anchorNode = AnchorNode(anchor).apply {
isSmoothed = true
setParent(arFragment!!.arSceneView.scene)
}
placedAnchorNodes.add(anchorNode)
val node = TransformableNode(arFragment!!.transformationSystem)
.apply{
this.rotationController.isEnabled = false
this.scaleController.isEnabled = false
this.translationController.isEnabled = true
this.renderable = renderable
setParent(anchorNode)
}
arFragment!!.arSceneView.scene.addOnUpdateListener(this)
arFragment!!.arSceneView.scene.addChild(anchorNode)
node.select()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment