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? )
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);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With