How to remove 3D object/model #276
-
How to remove an object (model.glb) , which is added from library and you want to remove it with a click on that object or after button click and after remove u want to insert new for example second object from library. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
|
Beta Was this translation helpful? Give feedback.
-
Yes, but I have a problem that I don't know where I get this AnchorNode from. Look at this. This is function where I am adding objects. I don't know how to access this AnchorNode in code and create removeObject function. Can u help me with it? private fun onTapPlane(hitResult: HitResult, plane: Plane, motionEvent: MotionEvent) {
if (model == null) {
Toast.makeText(context, "Select a model", Toast.LENGTH_SHORT).show()
return
}
// Create the Anchor.
scene.addChild(AnchorNode(hitResult.createAnchor()).apply {
// Create the transformable model and add it to the anchor.
addChild(TransformableNode(arFragment.transformationSystem).apply {
renderable = model
renderableInstance.animate(true).start()
// Add the View
addChild(Node().apply {
// Define the relative position
localPosition = Vector3(0.0f, 1f, 0.0f)
localScale = Vector3(0.7f, 0.7f, 0.7f)
})
})
})
} |
Beta Was this translation helpful? Give feedback.
AnchorNode
) as described here: https://sceneview.github.io/sceneform-android/remove_node