I am trying to trigger my score function whenever the camera collide or touch an object like:
<a-entity id="rock" static-body obj-model="obj:models/rock_mesh.obj;mtl:images/rock_mesh.mtl" rotation="0 90 0" position="7.30242379045994 0.3 0">
</a-entity>
I equip my a score text on my camera:
<a-text id="score" value="0" position="-0.2 -0.5 -1" color="red" width="5" anchor="left"></a-text>
And trying to trigger a function like this:
let score = 0;
score = score + 1
$("#score").setAttribute('text','value','Score '+score)
This is just a draft up code, I am still new to javascript
How can i do this? Incrementing the score on the screen whenever my camera touches this "rock" object?
How can i detect the collision or touch with the object and my camera?
Thanks in advance.