Reputation: 2683
I have rotating object (sphere). When I click on an object, I get coordinates relative to camera by:
var raycaster = new THREE.Raycaster();
raycaster.setFromCamera( mouse, camera );
var intersects = raycaster.intersectObjects( cameradestinations, true );
How can I get this coordinates relative to clicked object position, not to scene center?
(yes I can make clicked.point - clicked.position, but is here something smarter? )
Upvotes: 5
Views: 304
Reputation: 4805
If you have a vector with World coordinates and want them in an objects Local space, you can use the .worldToLocal() method in Object3D class.
intersectedObject.worldToLocal(point);
Upvotes: 3