kuligs2 Why are you using two nodes for a plane? use just a single plane. And try it without lerping first.
This works as expected for me:

$plane.global_position.y = -1e10
for mesh in $meshy_node.get_children():
	$plane.global_position.y = max($plane.global_position.y, (mesh.global_transform * mesh.get_aabb()).end.y)

    xyz

    Well, there are many ways of doing it, but yes, your method works aswell. Your solution is compact and straight to the point, while i was trying to debug step by step to see what kind of values are produced because to me it didnt made sense.

    This was just an exercise to learn how things work.
    Before i looked up in here this is what i came up with and it produced same result.

    	# this works
    	var mesh_array = meshy_node.get_children()
    
    	for mesh in mesh_array:
    		var mesh_aabb = mesh.get_aabb().abs()
    		var mesh_glob_trans = mesh.global_transform
    		var glob_mesh_aabb =  mesh_glob_trans * mesh_aabb 
    		
    		global_aabb = global_aabb.merge(glob_mesh_aabb)

    then get the .end prop from that aabb to get the desired Y position.
    Note: .abs() is optional, it still produces same result.

    but TLDR my problem was that the order of multiplication was not correct (wierd). In meths it didnt matter if you multiply 5x2 or 2x5, result is the same. Here i guess it matters.

    #does not work
    var glob_mesh_aabb = mesh_aabb * mesh_glob_trans

    to

    #works
    var glob_mesh_aabb =  mesh_glob_trans * mesh_aabb
    • xyz replied to this.

      kuligs2 Yeah using operator * with a transform object basically does matrix-matrix multiplication which is non-commutative.

      Also note that you call merge() on global_aabb without previously initializing it with your first aabb. So the default zero aabb will get merged into your final bbox. This may cause incorrect final box if none of your boxes envelops the global origin.

        xyz uhm, what do you mean merge() on empty aabb is wrong? Do you mean i need to set the position property for the aabb? Or do i need to multiply it with node.global_transform?

        • xyz replied to this.

          kuligs2 merge() is a method of an aabb object. The object needs to be one of your boxes before merging it with another of your boxes, otherwise, at the first iteration, it'll merge your first box with the default [(0,0,0), (0,0,0)] box.

          # merges box1, box2 and the default zero box
          var box: AABB #now contains default zero box
          box.merge(box1)
          box.merge(box2)
          # properly merges only box1 and box2
          var box: AABB = box1
          box.merge(box2)