Hello.
I am currently working on a small project. Basically, I want to have a cube in AR, which I can move, rotate, and resize, similar to this:
I got the moving part working and right now I want to have a button that will rotate my object on press.
This code is to test if the button interaction works in the first place.
// jshint esversion: 6, unused: true, varstmt: true
const RotateControls = pc.createScript('rotateControls');
RotateControls.attributes.add('rotateButton', { type: 'entity' });
RotateControls.prototype.initialize = function() {
const rotateButton = this.rotateButton.element;
console.log(rotateButton);
rotateButton.on('touchstart', () => alert('hello') , this);
};
The code works only if the AR session has not started yet. But as soon as I start the AR session, the button does not do anything. I think this may have something to do with the hit test for AR which probably takes precedent over the button event but I donât know yet how to fix this.
Any ideas?