- Home /
Wrong positions from bounds
Hello, i have problem with Renderer.bounds positions of imported object from blender. I have script that create box around selected object/objects depend of their min/max bounds.
When i test it on prefab objects from unity then it work.
But when i try objects from blender then it works only sometimes.
Both objects have only one mesh. Object on left is correct, but object on right have box like 50% bigger.
Both are made exactly same, difference is just a bit in visual. When i check the values from Renderer.bounds of that wrong object then values was already there wrong.
I tried create two sphere prefabs and placed them in position from bounds and there was exactly on corners of that created box.
Know somebody what can cause this ?
is there way how to avoid this ?
if its necessary i can share whole code how i creating that box. Thx for any help.
Answer by Bunny83 · Dec 26, 2020 at 04:31 PM
Well, the bounding box is always axis aligned. Renderer,bounds essentially represents the AABB of the mesh's local bounding box. See my answer and the comments below my answer.
You are right, problem is in object rotation but it dont look like it because model is created in rotated Z axis so it look like its not rotated so it mess up my code.
Your answer
Follow this Question
Related Questions
Help with setting the size of a GameObject using bounds 0 Answers
Placing a GameObject on top of another GameObject. 1 Answer
Changing two different objects renderer colour 1 Answer
Why isn't this mesh not appearing properly? 0 Answers
Can't convert Bounds from world coordinates to local coordinates 6 Answers