How to set AABB to a mesh?

Godot Version

4.4 dev2

Question

	var aabb: AABB = _mesh.get_aabb()
	aabb.merge(bounds)
	aabb = _mesh.get_aabb()

what I want it to force bounds in to _mesh AABB

how could I do that?
do I need a specific mesh I’m using ImmediateMesh

Assign custom_aabb

1 Like

Invalid call. Nonexistent function ‘custom_aabb’ in base ‘ImmediateMesh’.

AABB doesn’t have that function either

Not a function, a property on MeshInstance3D

hmmmm, …

Invalid assignment of property or key 'custom_aabb' with value of type 'AABB' on a base object of type 'ImmediateMesh'.

Not on ImmediateMesh, on the MeshInstance3D you use it in

var aabb: AABB = _mesh.get_aabb()
_object.custom_aabb = bounds
_object.mesh = ImmediateMesh.new()
_object.custom_aabb = bounds
aabb = _object.mesh.get_aabb()

ok I finally found how to set it but when I get the aabb it’s values are 0

The get_aabb() method of the mesh is not affected by this, you can’t change the AABB of a Mesh like that

What are you trying to do?

no idea but I’m trying to translate full voxel that I’ve bought years back on unity 3d

If you want to change the AABB (i.e. the bounds used for visibility) you need to use custom_aabb, do you need to use it? You don’t seem to actually do anything with the ImmediateMesh, you need to actually add something to it, you are just using an empty mesh