Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Ícaro Dantas de Araú |
Hello, I need to know the size of a 3d object, so I was looking for some way to get the AABB. ArrayMesh unfortunately does not have.
I tried to do the following:
func get_bounds(nd):
var mdt = MeshDataTool.new()
var m = nd.get_mesh()
#get surface 0 into mesh data tool
mdt.create_from_surface(m, 0)
var bounds = AABB()
for vtx in range(mdt.get_vertex_count()):
var vert=mdt.get_vertex(vtx)
bounds = bounds.expand(nd.global_transform.xform(vert))
return bounds
But with some simple tests I realized it doesn’t work, can anyone help me?