Issues with Raycasting and Mouse Interaction for GLTF Models in Three.js

  • Hello everyone,

    I'm currently working on a project where I need to load and interact with 3D objects from a GLTF file using Three.js. While I can successfully load and display the models, I'm encountering issues with mouse interactions, specifically raycasting. Here are the details:

    • Loading and Displaying Models:
      • I am able to load and display models from a .gltf file using GLTFLoader.
      • The models appear correctly in the scene, with proper orientation and lighting.
    • Raycasting Setup:
      • I have set up raycasting to detect mouse interactions.
      • The mouse cursor changes to a hand when hovering over objects loaded from a JSON file, indicating that raycasting works in that context.
      • For objects loaded from the GLTF file, mouse clicks and interactions initially work, but issues arise after vertical movement of the panorama.
    • Problem Description:

      • Initial Interaction: Mouse interactions such as clicking are detected properly on GLTF objects when the panorama is first loaded.
      • Post-Movement Issue: After vertically moving the panorama, mouse click events do not accurately target the GLTF objects. Instead, clicks are registered above or below the intended object.

        Below I have attached the functionality.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!