Hello
I am pretty new at three and i’m having a problem in my app. I have a THREE.Group and in that group objects with changed position. When app renders and the group moves, everything looks nicely, but now I need to get the position of one of the children in order to create another (independant, not another child) object at that exact position. Here is somewhat simple example of my code.
var obj1 = new THREE.Mesh(someGeometry, someMaterial);
obj1.translateY(1.5); obj1.translateZ(2.5);
var obj2 = new THREE.Mesh(someGeometry, someMaterial);
obj2.translateY(-5); obj2.translateZ(2.5);
var obj3 = new THREE.Mesh(someGeometry, someMaterial);
obj3.translateY(3); obj3.translateZ(3);
var myGroup = new THREE.Group();
myGroup.add(obj1, obj2, obj3);
myGroup.position.set(somex, somey, somez);
scene.add(myGroup);
someOtherObject.position.set(?, ? , ?);
Now, if I want to create some other object and place it at the position of obj3, then how do I do it? myGroup.children[2].position gives me only x: 0, y: 3, z: 3, even if the group had already moved.
I have looked at many questions and tried multiple answers, but they never seemed to work correctly. Functions either no longer existed or returned position ( 0 , 0 , 0 ) or something else completely.
What would be the correct and most optimal solution as of right now? (three R89)
Thank you in advance