Last active
November 17, 2020 22:18
-
-
Save daniel-schroeder-dev/7cdd79e8ba8a33bdea9710875a90d69a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html> | |
| <head> | |
| <script src="https://aframe.io/releases/1.0.4/aframe.min.js"></script> | |
| <script src="https://unpkg.com/aframe-aabb-collider-component@3.1.0/dist/aframe-aabb-collider-component.min.js"></script> | |
| <script type="text/javascript" src="https://unpkg.com/jquery@3.3.1/dist/jquery.min.js"></script> | |
| <script type="text/javascript"> | |
| function checkpoint() { | |
| console.log('hit the checkpoint'); | |
| } | |
| AFRAME.registerComponent('hit-box', { | |
| init: function() { | |
| $(this.el).on('hitstart', checkpoint); | |
| }, | |
| }); | |
| </script> | |
| </head> | |
| <body> | |
| <a-scene> | |
| <a-camera geometry="primitive: box" aabb-collider="objects: .checkpoint; collideNonVisible: true;"> | |
| </a-camera> | |
| <a-assets> | |
| <img id="water" src="water.jpg"> | |
| </a-assets> | |
| <a-sphere hit-box visible="false" class="checkpoint" color="black" radius="5" position="0 0 -10"></a-sphere> | |
| <a-circle src="#water" radius="5" position="0 0 -10" rotation="90 0 0" material="side: double;"></a-circle> | |
| </a-scene> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment