How can I retrieve the exact coordinate I clicked on a rotated object

I’ve created this Stackoverflow Post. With this video.

Basically my problem is that if an object is not rotated when I click on it I get easily the coordinates of the postion clicked on the object. Let’s say my object ( a rectangle ) is 200*100 then with a simple calculation I can say I’ve clicked on the point ( 10,10 ) of it by making a substraction of the mouse by the object position.

Now if I rotate the object this calculation no longer works.

Do you know how I could perform that?

Many thanks in advance.

Hi!
Do you use THREE.Raycaster()?

Yes on a certain level of my project but I guess I can’t use it in my case. I don’t need to know which object I’ve been clicking on but more which coordinate I’m clicking on the object plane. I would prefer using my own calculation but if you tell me raycaster can do this I’ll look into it a bit more.

There are several examples with the using of Raycaster: three.js examples
When you get an array of intersected objects, calling .intersectObject( your_plane_mesh ), the items of the array are objects contain the property “point”, which is a point of intersection in global space coordinates. To cast this point into the local space of the plane, use your_plane_mesh.worldToLocal( point_of_intersection ).

1 Like

ok many thanks I’ll try resolving my issue with this and get back to you If this doesn’t fit my needs.

Best