sceneview-android icon indicating copy to clipboard operation
sceneview-android copied to clipboard

Select 3d object jetpack compose.

Open David7145g opened this issue 1 year ago • 2 comments

Hello everyone! I created an AR application with jetpack compose. I added 5 models to the screen using a tap, I did everything as in the example. When I use

	val modelInstances = remember { mutableListOf<ModelInstance>() }
	val childNodes = rememberNodes()
onGestureListener = rememberOnGestureListener(
	onSingleTapConfirmed = { motionEvent, node -> 
				
	}
)

I can't find 'node ->' in 'childNodes' PS - Objects are added correctly. The childNodes list is the correct size.

How can I select multiple objects to change their color and delete them?

David7145g avatar Jan 10 '24 12:01 David7145g

I was able to change the color of the selected model. Tell me, is this the optimal solution?

			onGestureListener = rememberOnGestureListener(
				onSingleTapConfirmed = { motionEvent, node ->
					if (node != null) {


						val nodes = node.childNodes
						val renderableNodes = nodes.mapNotNull {
							it as? ModelNode.RenderableNode
						}
						renderableNodes.forEach {
							it.materialInstance.setColor(colorModel.copy(0.1f))
						}
					}
				}
			)

David7145g avatar Jan 10 '24 15:01 David7145g

The question remains - how can I select certain models in order to delete them later? If I do childNodes.indexOf(node) - I get an exception

David7145g avatar Jan 10 '24 15:01 David7145g

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Apr 10 '24 05:04 github-actions[bot]

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

github-actions[bot] avatar Apr 17 '24 05:04 github-actions[bot]