How to detect when a user taps on a 3D model?

Hello!

I’d recommend taking a look at this sample project: A-Frame: Tap to Place Ground | 8th Wall | 8th Wall

When the user taps on the “ground” object in the scene (a transparent plane) it spawns a 3d model at that location.

Some of the key pieces here:

  1. Camera has a raycaster, configured to interact with entities that have the “cantap” class (see A-Frame: Tap to Place Ground | 8th Wall | 8th Wall)
  2. Receiving entity (“ground plane”) configured with class="cantap" to receive raycasts (see A-Frame: Tap to Place Ground | 8th Wall | 8th Wall)
  3. The ground object then has a click event handler (in this case it spawns other 3d models, but you could put your own custom logic there to do something different - A-Frame: Tap to Place Ground | 8th Wall | 8th Wall)

Raycaster documentation: raycaster – A-Frame

Hope this helps!