- Home /
Bounds center does NOT match the transform.position
InverseTransformPoint
is not working for us. Always the same as worldSpace. GameObject is translated and bounds center point never matches the GO position. We tried sever RecalculateBounds
on LOD and the Mesh. Nothing changes.
var localSpace = transform.InverseTransformPoint(new Vector3(x, y, z));
var worldSpace = transform.TransformPoint(new Vector3(x, y, z));
GameObject is translated and bounds center point never matches the GO position
For this to be true mesh.bounds.center
must be { 0 , 0 , 0 }
which is rarely the case.
Answer by andrew-lukasik · May 17, 2021 at 08:21 AM
Vector3 worldPoint = transform.TransformPoint( LOCAL_POSITION )
is exactly the same as:
Vector3 worldPoint = transform.localToWorldMatrix.MultiplyPoint( LOCAL_POSITION )
Vector3 localPoint = transform.InverseTransformPoint( WORLD_POSITION )
is exactly the same as:
Vector3 localPoint = transform.localToWorldMatrix.inverse.MultiplyPoint( WORLD_POSITION )
If you have problem with TransformPoint
, try the manual option.
Answer by zenforhire · May 16, 2021 at 09:09 PM
The bug/design change is in 2019.4.4. We upgraded our 2018.4.3 build to 2019.4.4. Our buoyancy scripts broke due to the InversveTransfromPoint/TransformPoint not working.
We gave up and hacked a solution. Instead of calling TransformPoint methods, we put a gameobject sphere at each position that needed transform calculation. We now use the transform.position to convert local to world space.
Your answer
