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:
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.
Inherits: Node3D< Node< Object Inherited By: Decal, FogVolume, GeometryInstance3D, GPUParticlesAttractor3D, GPUParticlesCollision3D, Light3D, LightmapGI, ReflectionProbe, RootMotionView, VisibleOnS...
system
Closed
June 25, 2024, 3:30am
3
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.