Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

98
Views
El evento táctil Raycast threejs no funciona con el evento del mouse

He estado trabajando en threejs mouse raycast con fabricjs, y ahora está funcionando aquí, pero el problema es que el objeto no se movió si estaba usando un teléfono inteligente que usa el tacto. ¿Debo crear otro detector de eventos para el evento táctil? ¿O debería funcionar bien usando el evento del mouse?

así es como puedo mover el objeto

 if (e.target !== this.upperCanvasEl) { var positionOnScene = getPositionOnScene(container, e); pointer.x = positionOnScene.x; pointer.y = positionOnScene.y; }

y aquí está la función getPositionOnScene

 function getPositionOnScene(sceneContainer, evt) { var array = getMousePosition(container, evt.clientX, evt.clientY); onClickPosition.fromArray(array); var intersects = getIntersects(onClickPosition, scene.children); if (intersects.length > 0 && intersects[0].uv) { var uv = intersects[0].uv; intersects[0].object.material.map.transformUv(uv); return { x: getRealPosition('x', uv.x), y: getRealPosition('y', uv.y) } } return null }

¿Alguien puede ayudarme? cualquier pensamiento sería realmente útil

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Hay 2 razones.

1:

Devuelve nulo en la función `getPositionOnScene`.

2:

Touch no es lo mismo que un evento de mouse.

Tendrás que hacer `document.addEventListener("mousedown", devolución de llamada)`
por lo que también admite eventos de mouse.
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!