[SOLVED] Mesh AABBs are shifted in space

Godot Version

4.2.2

Question

Hi

I am using aabb to test some visibility so I have this test code that lists objects actual position and the calculated aabb position which you can see in the image and the code.

Is there another way to get the actual world transforms of these aabb

code that outputs the image values

    var children
    children=get_children()    
    for c in children:
        var aabb=c.transform*c.get_aabb()
        print(" -> ", c.position," -> ", aabb.position)


And here is the outputs, as you can see all the aabb values are shifted. In theory they should be right around where the object is. These objects are hexagonal and they have no rotations

the screen left is the actual position and the screen right is the aabb position calculated by var aabb=c.transform*c.get_aabb() which can be seen in the code

I checked the root and the scene parent to see if there is any transforms there. but there are none (which should not matter anyway since I am calculating these right in the scene). You can see that they are pushed by x=-10 and z=8

I put label3D where the aabs are placed in the scene and all the text is shifted consistently in runtime in 3d space, so something is funky for some reason.

Here is one of the objects selected, its viewport aabb seems to be correct

EDIT: I completely misunderstood where the bbox starting point should be. I origihnally thought that bbox position was at the center and size would determine how far the corners are from the center.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.