Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

150
Visualizações
A-Frame - Object intersections are returning null on Safari browser and iOS related devices

I have the following component registered to my 3D glb object:

AFRAME.registerComponent('room', {
init: function() {

    let mesh = this.el.getObject3D('mesh')

    if (!mesh) {
        this.el.addEventListener('model-loaded', () => {
            el.addEventListener("click", evt => {
                console.log(evt)
                if (evt.detail !== null) {
                    this.intersection = evt.detail.intersection
                }
            });
        })
    }
},
});

In my camera object, I have placed the cursor with the raycaster attached:

    <a-entity camera-listener id="rig" class='rig' movement-controls="speed: 0.1;" navigator="cameraRig: #rig; cameraHead: #camera-rig;">
      <a-entity id="camera-rig" camera="active: true" position="0 1.6 0" look-controls="pointerLockEnabled: false; reverseMouseDrag: true">
        <a-entity id="mouseCursor" cursor="rayOrigin: mouse" raycaster="objects: .collidable"></a-entity>
      </a-entity>
      <a-entity laser-controls="hand: left" visible="true" raycaster="objects: .collidable;"></a-entity>
      <a-entity laser-controls="hand: right" visible="true" raycaster="objects: .collidable;"></a-entity>
    </a-entity>

When testing the app on Chrome, Firefox and Android devices the variable "evt" returns with a detail attribute that is not null that can be assigned to decide which child element of my glb object has been clicked. It works for me perfectly in these cases.

However, on Safari and iOS devices, the detail attribute of "evt" is always null and causes my app to crash if not checked. The check is easy but the main issue is that on these browsers I cannot detect which child object has been clicked from my glb as part of the scene.

Is there another way of raycasting that works across all browsers or have I made a mistake with my configuration? Any help would be much appreciated.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda