The coordinates of the clicked object relative to the same object

I have a rotating object (sphere). When I click on an object, I get the coordinates relative to the camera:

var raycaster = new THREE.Raycaster(); raycaster.setFromCamera( mouse, camera ); var intersects = raycaster.intersectObjects( cameradestinations, true ); 

How can I get these coordinates relative to the position of the click object, and not the center of the scene?

(yes, I can do clicked.point - clicked.position, but is there something smarter here?)

+5
source share
1 answer

If you have a vector with World coordinates and want them in Local Space objects, you can use the .worldToLocal () method in the Object3D class.

 intersectedObject.worldToLocal(point); 
+3
source

All Articles