I have just confused myself into a total dead end.
Say you have a Blender character model that is split in different body parts (head, body,…) resulting in a BAbylon hierarchy as follows:
_root → armature → [head, eyes, body, …].
You want to get the location of the eyes from where to cast a ray later on (let’s say it’s a pirate). You need a source vector for the raycast. I assume the source vector is in some sort of a “world coordinate space”.
This world coordinate space seems to work perfectly fine when applied to root nodes. For instance, I can apply a “world” vector to the root node of my character model and it visually relocates as expected.
However, when I query the location of the eyes (child mesh) with getAbsolutePosition() I get a position equal to the root node. But this clearly is not the “world” position of the eyes. FYI, all child meshes (body parts) return the same position equal to the root node.
I mean at some point there must be the relational data that locate the body parts (child meshes) in a way as to make them appear as a character. I would assume this data must be in some common world space?
Anyway, I did get it to work by using mesh.getBoundingInfo().boundingBox.centerWorld (as suggested here).
But why? Why would the bounding box have different coordinates than the bound mesh and why would both mesh and box render perfectly fine on screen - in the same location?
getAbsolutePosition should work so I am not sure what could go wrong in your case maybe the matrices have not been computed so far when you call it. In this case you could force computing it before with mesh.computeWorldMatrix(true) but a playground repro would really help here ?
I think that the problem is in the imported 3d-model itself. At least in this playground example the pivots of all child meshes are actually in same position as the _root node (0,0,0). I added the axis viewers to all child meshes and those seems to be in zero point. You have to reset mesh pivots in 3d-editor (Blender / 3dsmax) to the desired location and then export model again. Then you get those points with getAbsolutePosition().