Trying to make a CHILD of an object look at a position (which is in global/world space)
Here's what I've got, but it doesn't work. Direction of arrow seems to roam around in unpredictable directions.
Update (added example): https://jsfiddle.net/um8cxp3b/27/
makeArrowLookAt(obj, position) {
// obj.lookAt(position); // works PERFECTLY, but I want a child object to lookAt...
const posVector = new THREE.Vector3().copy(position); // copy
const localVector = obj.worldToLocal(posVector); // get local position offset
localVector.normalize(); // converts local offset to rotation... right?
// Apply the localised rotation to the object
obj.children[0].rotation.x = localVector.x;
obj.children[0].rotation.y = localVector.y;
obj.children[0].rotation.z = localVector.z;
}
(Note the child in this case is an arrowHelper to illustrate direction)