My goal is for taps and drags to be able to identify if a 3d model has been hit using motionEvents.
The current implementation works, but it is not very accurate. Most of the time tapping the model results in tappedOnModel being false, while dragging seems to work quite decently. Is there a way to improve the accuracy without using Sceneform or SceneView?
arCore.filament.view.pick(
(filament.surfaceView.width.toFloat() * modelEvent.screenPosition.x).toInt(),
(filament.surfaceView.height.toFloat() * modelEvent.screenPosition.y).toInt(),
Handler(Looper.getMainLooper())
) {
tappedModelRenderable = it.renderable
tappedOnModel = modelRenderables.any {
it.any {
it == tappedModelRenderable
}
}
}
if (tappedOnModel) {
for (i in modelRenderables.indices) {
for (j in modelRenderables[i]) {
if (j == tappedModelRenderable) {
selectedModelIndex = i
break
}
}
}
}