I’m trying to get touchevents working for my mobile game in threejs. But the controls dont work because it keeps scrolling! even though I have event.preventdefault . I would debug it in Chrome DevTools but it actually works in DevTools, but on my Pixel 3a it doesnt work
GitHub Link to Project: https://github.com/spikethea/3d-platformer
Heres a link to my game
http://quincegorerodney.panel.uwe.ac.uk/secret%20levels/
i made a quick YouTube video too to show me attempting to use it https://www.youtube.com/watch?v=hdCeN8F7uW4
this is the render setup code
//Renderer
const canvas = document.querySelector(‘#c’);
renderer = new THREE.WebGLRenderer( { canvas, antialias: true, alpha: true } );
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth/2, window.innerHeight/2, false );
document.body.appendChild( renderer.domElement );
renderer.gammaFactor = 2.2;//Correcting the scenes Gamma Values
renderer.gammaFactor = true;
renderer.outputEncoding = THREE.GammaEncoding;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap
//Camera
camera = new THREE.PerspectiveCamera( 70, window.innerWidth / window.innerHeight, 0.01, 1000 );
camera.position.z = 20;
camera.position.y = 15;
//controls.update() must be called after any manual changes to the camera's transform