Search Issue Tracker
By Design
Votes
0
Found in
2017.3.1p3
Issue ID
1022365
Regression
No
Mesh.bounds.center returns word space position instead of local space
Steps to reproduce:
1. Open the attached project
2. Open the SampleScene.unity scene
3. The scene contains empty gameobject(Parent) and cube as a child gameobject
4. Cube's word space position is (0,0,5)
5. Play the scene
6. Observe the Console Window, it prints (0,0,5) instead of local space position as a documentation states
Reproduced with: 2017.1.3p2, 2017.2.2p3, 2017.4.1f1, 2018.1.0b13, 2018.2.0a7
Note:
https://docs.unity3d.com/ScriptReference/Mesh-bounds.html
Actual results Mesh.bounds.center returns word space position
Expected: Mesh.bounds.center should return local space position
Comments (1)
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Render Graph Execution errors when using GPU occlusion culling with 'Opaque Objects' frame setting disabled on a Camera
- Animator window: “Delete” menu item not greyed out for Base Layer context menu
- Resetting “PC_RP Asset (Universal Render Pipeline Asset)” causes Game view to become black and throws Renderer and NullReference errors in the Console window
- [Mobile] Player Crash on scripting_invoke_profiler_begin when the built Player Scene has an empty UIDocument and is built on IL2CPP
- Unnecessary Warnings are logged when running Player with -batchmode -nographics
marctem
Apr 30, 2018 15:59
Mesh.bounds.center _does_ return local space position. The code in your example project is using GetComponent<MeshRenderer>(), and as noted in the docs you linked, MeshRenderer.bounds.center returns world space position.
If you want local space, you should use GetComponent<MeshFilter>().mesh.bounds.center.