Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to show a Label(or text ) over Node #572

Open
mudasirmukhtar-abyte opened this issue Oct 16, 2024 · 0 comments
Open

How to show a Label(or text ) over Node #572

mudasirmukhtar-abyte opened this issue Oct 16, 2024 · 0 comments

Comments

@mudasirmukhtar-abyte
Copy link

mudasirmukhtar-abyte commented Oct 16, 2024

I need to display labels or text annotations above specific nodes. I've successfully added child nodes to my AnchorNode, but I'm unable to find a straightforward way to attach labels to these nodes.

fun addChildNodeToAnchor(parentNode: Node, position: Position) { Node(binding.arSceneView.engine).apply { isEditable = false name = "child node" lifecycleScope.launch { withContext(Dispatchers.Main) { val modelNode = buildModelNode("child", position, "myModel.glb", 0.25f) modelNode?.let { addChildNode(it) it.position = Position(x = position[0], y = position[1], z = position[2]) } parent = parentNode } } } }

fun buildModelNode(
    nodeName: String,
    position: Position,
    modelToLoad: String,
    scaleToUnits: Float
): ModelNode? {
    binding.arSceneView.modelLoader.loadModelInstance(
        modelToLoad
    )?.let { modelInstance ->
        return ModelNode(
            modelInstance = modelInstance,
            autoAnimate = false,
            scaleToUnits = scaleToUnits,
            centerOrigin = position
        ).apply {
            name = nodeName
            isEditable = true
        }
    }
    return null
}

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant