Here is my scene, the user can move the pot on the floor by mouse or touches.
The scene model has the following mesh instances:
I am finding a way to get the mesh instance where the user clicked / tapped.
The physics way by
app.systems.rigidbody.raycastFirst only return the entity, normal, point, not including the mesh instance…
The picker way by
pc.Picker can return mesh instances, however when the user move the pot, the mouse/touches will always on the pot, so the picker only return the pots’ mesh instances, not the scene model’s mesh instances. what’s more, the picker way should not be used on mobile devices because of the performance.
The bounding box way by
boudingbox.intersectsRay will do the trick in simple scenes, when usint it in a complex scene model, it sucks. See the following scene:
When I click the floor, as the floor’s bounding box and the railing’s bounding box intersects, I can always get them, but this is not what I want.
What I want is Raycaster.intersectObject in three.js…
Is there any way to do this ?