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

Graphics - General

-

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)

  1. 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.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.