Search code examples
androidarcoresceneform

ViewRenderable click handling after updating rotation


I have a CameraFacingNode which updates the rotation of the node:

        val cameraPosition = scene!!.camera.worldPosition
        val direction = Vector3.subtract(cameraPosition, worldPosition)
        val lookRotation = Quaternion.lookRotation(direction, Vector3.up())
        super.setWorldRotation(lookRotation)

This node has a ViewRenderable attached to it. And there's 2 buttons: one is in the center of the view(working with click listener correctly), while another one is at the end of the view(for which I'm unable to receive the click callback).

I assume the view renderable position is not aligned somehow and when I'm clicking on the second button ArCore thinks it's not there.

So generally the question is if someone encountered the issue with handling click in ViewRenderable after updating its rotation.


Solution

  • Actually issue was in incorrect rotation for 180 degrees: Correct line: ''' val direction = Vector3.subtract(worldPosition, cameraPosition) '''