Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Click with a a-entity (gltf) object #559

Open
dpayet opened this issue Aug 16, 2023 · 3 comments
Open

Click with a a-entity (gltf) object #559

dpayet opened this issue Aug 16, 2023 · 3 comments

Comments

@dpayet
Copy link

dpayet commented Aug 16, 2023

Do you want to request a feature or report a bug?

Bug, I think.

What is the current behavior?

An a-entity not clickable. Is it possible ?

If the current behavior is a bug, please provide the steps to reproduce.

  <a-scene
     arjs
     embedded
     renderer="logarithmicDepthBuffer: true;"
     vr-mode-ui="enabled: false"
     gesture-detector
     id="scene"
   >
     <a-assets>
       <a-asset-item
         id="key"
         src="models/key2.glb"
       >
       </a-asset-item>
     </a-assets>

     <a-camera gps-new-camera='gpsMinDistance: 5'></a-camera>
     <a-camera gps-projected-camera='simulateLatitude: lat; simulateLongitude: lng' rotation-reader></a-camera>


       <a-entity
         id="key-model"
   	  clicker 
   	  gps-projected-entity-place='latitude: lat; longitude: lng'
         animation="property: rotation; to: 0 360 0; loop: true; dur: 10000"
   	  gltf-model="#key"
         position="0 0 0"
         scale="0.03 0.03 0.03"
         gesture-handler
       >
       </a-entity>
      
     <a-entity camera></a-entity>
   </a-scene>
   <script>
   	AFRAME.registerComponent('clicker', {
           init: function() {
               this.el.addEventListener('click', e => {
                   alert('Box clicked!');
               });
           }
       });
</script>

Please mention other relevant information such as the browser version, Operating System and Device Name

I've tried on Safari, Firefox and Chrome, all on iOS.

What is the expected behavior?

Perhaps have a little alert prompt :)

If this is a feature request, what is motivation or use case for changing the behavior?

Thanks you !

@nickw1
Copy link
Collaborator

nickw1 commented Aug 28, 2023

Hi, can you make your assets publicly available so I can test? Thanks.

@nickw1
Copy link
Collaborator

nickw1 commented Aug 31, 2023

Hi, I have just realised you're missing the cursor and raycaster components.

Also you have two <a-camera>s, is this intentional?

Have a look at this example:

https://github.com/AR-js-org/AR.js/blob/master/aframe/examples/new-location-based/click-places/index.html

and see if you can get it to work based off that code.

@dpayet
Copy link
Author

dpayet commented Dec 31, 2023

It's working ! A huge thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants