Virtual Reality

Adding Shooting

1) Add the following code into your <head> section.



<script src="https://www.codechangers.com/lessons/vr/aframe/physics.js"></script>

2) Add the following code right before your </body> section.



<script src="https://www.codechangers.com/lessons/vr/aframe/shoot.js"></script>
<script src="https://www.codechangers.com/lessons/vr/aframe/vr.js"></script>

3) Replace your current <a-scene> tag with the code below:



<a-scene id="myScene">

4) Add this code inside your <a-scene>.



<a-camera pointer-lock-enabled="true" position="0 1 0" id="myCamera">
   <a-cursor fuse="true"></a-cursor>
</a-camera>