How to get the dimensions of a MeshInstance3D?

Godot Version

Godot v4.1.1

Question

i haven’t seen this talked about for Godot 4. How do I call the size (length, width, height) of a MeshInstance3D? I need it for some hacky camera movement business.
Currently I get this error message upon starting:

DevSer4a
for this:


(I’d show you the rest but it’s pretty foul-mouthed lol)

I’ve also tried:

  • self.mesh.size.[y/z] ← appears to have worked in Godot 3
  • self.MeshInstance3D.size.[y/z] ← silly
  • self.get_[height/depth].[y/z] ← maybe used to work? Not sure, doesn’t matter

It should be the simplest thing, but it doesn’t appear to be.

I’ve not used this myself yet (only doing 2D work right now), but a glance at the docs seems to indicate that you want to use something like:

self.mesh.get_aabb().size

The AABB has a Vector3 size property that could be what you need. Note that size could be negative and you might want to use abs() function instead.