-
-
Notifications
You must be signed in to change notification settings - Fork 204
Description
Summary
I have a screen with a fixed arrow in the middle that rotates based on a compass heading (points to a GPS target). This worked for years on io.github.sceneview:arsceneview:0.9.4 by parenting the arrow under cameraNode.
Due to Google’s 16 KB page-size requirement I upgraded to io.github.sceneview:arsceneview:2.3.0. After upgrading, parenting to cameraNode no longer renders the arrow (invisible). If I add the same node to the scene root, it renders—but in world space (not HUD-fixed to the screen).
What changed
sceneView.addChildNode(arrow) → arrow is visible, but at a fixed world position.
sceneView.cameraNode.addChildNode(arrow) → arrow is not visible (it used to be visible and fixed to the screen center on 0.9.4).
I’m trying to confirm whether this is an intentional change in 2.x or a regression, and if there’s a supported way to attach a node to the camera for HUD-style rendering like before.
Repro steps
-Create a simple AR scene with ARSceneView.
-Load a small GLB (e.g., direction_arrow.glb) from assets/.
-Create a node for the model and try both:
-sceneView.addChildNode(node) (works, but world-anchored)
-sceneView.cameraNode.addChildNode(node) (does not render)
Minimal code
Old code (0.9.4) — worked (HUD fixed to camera)
`private fun addNodeToScene() {
lifecycleScope.launchWhenCreated {
arModelNode = ArModelNode(
placementMode = PlacementMode.INSTANT,
hitPosition = Position(0.0f, -0.1f, -0.3f),
followHitPosition = false,
instantAnchor = false
)
arModelNode?.loadModelGlb(
context = requireContext(),
lifecycle = lifecycle,
glbFileLocation = localModel,
scaleToUnits = 0.5f,
autoAnimate = true,
onError = {}
)
arModelNode?.apply {
parent = binding.sceneView.cameraNode
localPosition = Position(0f, -0.1f, -0.3f)
localScale = Position(0.3f, 0.3f, 0.3f)
isScaleEditable = false
isPositionEditable = false
isRotationEditable = true
}
}
}`
New code (2.3.0) — does not render when parented to cameraNode
`private fun addNodeToScene() {
viewLifecycleOwner.lifecycleScope.launchWhenCreated {
val engine = binding.sceneView.engine
val modelLoader = ModelLoader(engine, requireContext())
val modelInstance = modelLoader.createModelInstance(localModel) ?: return@launchWhenCreated
arModelNode = ModelNode(
modelInstance = modelInstance,
scaleToUnits = 0.5f,
autoAnimate = true
).apply {
// Expect HUD-like: attach to camera
parent = binding.sceneView.cameraNode
position = io.github.sceneview.math.Position(0f, -0.1f, -0.3f)
scale = io.github.sceneview.math.Scale(0.3f)
isScaleEditable = false
isPositionEditable = false
isRotationEditable = true
}
}
}`
Expected behavior
When a node is a child of cameraNode, it should render fixed relative to the camera (HUD-style), as it did in 0.9.4.
Actual behavior
In 2.3.0, a child of cameraNode does not render (invisible). The same node added to the scene root renders correctly.