So I have an asset that is a child of a transform node. When I click on the asset, I want to download in (via loadAssetContainer) a different version of that asset in its place. When I assign the new asset’s position to the original asset’s position after I parent the new asset under the transform node that holds the original asset, the new asset’s position get’s assigned to the position of the parent transform (so it ends up being up in the air and skewed). When I don’t parent the new asset, and just assign it’s position to the position of the old asset, it gets placed at (0,0,0). I don’t really understand this, because if the original asset’s position was at (0,0,0), then it should be up in the air and skewed to the side like the new asset is when assigned to the old asset’s position. It should be at the transform node’s position. Since it is not, it would seem that it has different coordinates. But when I print out the original asset’s coordinates, its just (0,0,0). It would seem that the original asset’s coordinates are local coordinates, in relation to its parent. But then it should be at the parent’s transform location/position. Could it be that the original asset’s coordinates are global coordinates? And if so, how do I grab the global coordinates and how do I set the new asset’s global coordinates (or local coordinates, not sure when would make more sense to use in relation to the parent transform node) to those coordinates? I looked all over the documentation and couldn’t find a function that grabs the global coordinates of the mesh. Thanks in advance!
Hey…I would recommend to do two things
- Make sure you read this: Use a Parent - Babylon.js Documentation
- Create repro in the PG ( a simple version of course) so we can all check on the code and try to help