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

195
Views
Problem with click corner of fabricjs using threejs raycast

i'm trying to recreate this app, and it is currently working now. But i can't click the corner of the text perfectly, it always need to be offset.

https://jsfiddle.net/naonvl/ecdxfkbm/3/

right now, it's hard to scale the text. i think the getRealPosition is not correct so the mouse X and Y also not precise.

Does anyone know how to fix this?

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

0

The problem is i set getIntersects like this

var getIntersects = function (point, objects) {
  mouse.set(point.x * 2 - 0.97, -(point.y * 2) + 0.97);
  raycaster.setFromCamera(mouse, camera);
  return raycaster.intersectObjects(objects);
};

compare to three.js example here https://threejs.org/examples/#webgl_raycast_texture

function getIntersects( point, objects ) {
  mouse.set( ( point.x * 2 ) - 1, - ( point.y * 2 ) + 1 );
  raycaster.setFromCamera( mouse, camera );
  return raycaster.intersectObjects( objects, false );    
}

i miss calculate the mouse.set there, i change the calculation and tweak X and Y position of mouse by adding 3 to each of them, and it raycasted perfectly in the center of mouse pointer

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!