I applied the translation at geometry. Instead of mesh like
mesh.position.set…
To achieve my task. Now first thing when i do the mesh.position so it is giving me new THREE.Vector(0,0,0) and mesh.getWorldPosition is also seems wrong. I am curious to know now how i will get the exact position of my mesh.
mesh.position and mesh.getWorldPosition return the position of the Mesh. If you modify vertices inside the mesh - the position remains constant and mesh will generally act like a pivoting point at (0,0,0).
how i will get the exact position of my mesh
(0,0,0) is the exact position of that mesh. Imagine you put 10 LEGO™️ blocks in a box - then move them around. The position of the box doesn’t change because you move stuff inside it - so if you’d like to move the mesh, not the vertices, you should move the mesh instead of geometry.
Edit: One thing you may do, though (I can’t promise it’ll work). Create a Box3 and use Box3.setFromObject to wrap it around the vertices. Then use Box3.getCenter - this should return you the centre point of the geometry (based on vertex position average), which technically speaking can be treated as a position of your geometry.
I played the trick you shared but it is not working well. Technically it should.
here my case is like this :
geometry.translate(x,y,z)
So the objected shifted to the required position and when i am doing mesh.position so it gives 0,0,0.
As you explained the reason.
Here when i am moving the mesh after having it some location due to geometry level translation when i am doing mesh.position after the move it says 0,0,0 even but getWorldPosition is giving some value.
It may be something to make a play around with the code i guess that i will do.
But is there any better possibility so let me know.