"Get Dimensions" function/Blueprint node for StaticMesh assets

Hey everyone!

I don’t know if I’m alone in this, but I’ve worked on a couple of Blueprint systems that need to know the size of meshes in order to work properly. Right now, there seems to be no way to get the dimensions of a static mesh asset without it first existing in the world as a StaticMeshComponent or -Actor.

The workaround I’ve used so far is to add a new static mesh component, calculate the linear sizes from its bounds, and then destroy the component again - but that seems pretty wasteful.

So, here’s my request: Could we perhaps get a function that returns the dimensions of a static mesh asset directly?

Best,
Jan

+10000000.

1 Like

Agree, we generally need a way to access anything in a blueprint without creating it, so not only the bounds but also variables etc :slight_smile:

That sounds a bit strange.
How do you want to access something that does not exist?
If its a mesh variable, how would you know what mesh its referencing later on?
If its a mesh component, it already exists…

All variables are declared at design time. I dont get what you mean in terms of “creating variables”

Can you give an example use case of what you want to achieve with this and how you would use it.
So far, I havent encountered a scenario that “Get Local Bounds” wouldnt solve…

Hmm I can think of a scenario.
Let’s say that you want to spawn an object with the right offset so it fits exactly next to another… it would be useful to be able to get the dimensions before spawn.

It’s more for convenience really, it can be done either way.

Local Bounds only works on existing components. Edit to clarify: I would love for it (or something like it) to work with assets, too - i.e., content browser static mesh assets that do not yet exist in game. In my case, I’ve encountered the need for this in two different systems I’ve built already, both meant as a tool for sale on the marketplace - meaning that users would use their own meshes and assets with them, and I don’t know how big they’ll be.

The first case is a system to create networks of spline meshes, with an arbitrary number of sub-meshes. I need to check the size of the main mesh along the forward axis used by the spline, to make sure my auto-tile feature that figures out how many meshes to add over the length of the spline automatically works.

Edited, because it’s 6 am and I haven’t slept yet, so I gave inaccurate info :wink: The first case is the only one where it’s actually necessary, in the second case it was just a matter of convenience.

So just spawn the object, get the size and move it then.
I made a “linear stairs” brush that spawns a cube, scales it to the appropriate step dimensions and moves it into place.
All meshes are created, then scaled and moved…
I also made a Fasade system that follows the same route. (See screenshots at the end of the post)
https://forums.unrealengine.com/showthread.php?67946-How-to-change-mobility-setting-for-new-static-mesh-components&highlight=kvogler

Here I scale an object to absolute dimension, regardless of its initial native size:
(The pivot needs to in the center for this to work, but my assets account for that)

In this case, create the first mesh, examine it and then run the loop from there (minus one tile).

As I mentioned, spawning is not feasible because these things happen at editor time in the construction script.

I also described in the OP that my workaround basically does exactly that, except using “add component” - but it’s an unnecessary and not exactly cheap step to do every time the actor updates, which, when you drag around spline points, is supposed to happen per frame. Especially since the component serves no other function, because the actual system uses spline mesh components, not static mesh components. When you do that to dozens of meshes every frame, it creates some overhead that really shouldn’t be necessary. :wink:

Besides, this is not a “help me with blueprints” thread, but a feature request :stuck_out_tongue:

The same as my stuff…

All I wanted is to point out that there is a valid workflow that makes this feature request superflous in my oppinion. :stuck_out_tongue:

I know there’s a workaround, and I’m already using it, as I described in the OP. But I’m basically creating, measuring, and then destroying a component for the sole purpose of getting data that is available in the asset browser directly, and that’s terribly inefficient - and I’ve run into it often enough that it made me consider making this thread, so…

I recently had to know my static mesh dimensions during runtime, which doesn’t exist in the engine. I really recommend adding this feature.

Hi! Not sure how useful this is, but I am only using a staticmesh actor reference in the blueprint, not an actor, and not a component and using the UStaticMesh->CalculateExtendedBounds() and then UStaticMesh->GetBoundingBox(), then I am spawning the mesh component along a spline, so I also can not spawn measure and readjust as my size determines my loop count.

This works for me, no need to spawn and measure but you do need a reference to the static mesh itself somewhere in the blueprint via UStaticMesh.

Side note: SplineMeshClass->GetBounds().BoxExtent for this particular mesh was exactly half the scale of the bounding box, and bounding box also matches the Approx Size values I see on screen when opening the mesh.

Good luck!

Video Captions available (CC)

Hi Everyone,

The above video depicts my new measuring 3D application tool, recently developed with Unreal Engine 5, for a major client, using blueprints. Due to my non-disclosure agreement with them, I can’t showcase the original 3d scene developed for the client. Instead, I will be using one of Evermotion’s 3D scenes seen here, to showcase the Unreal Engine 3d Blueprint developed for them.

A client from the real-estate industry, asked me to create a 3d web application that allowed potential customers visiting their properties’ website, to be able to interact, select and measure the 3d space and furniture with few clicks.
This unique 3d tool should also help customers envisage and plan the appropriate furniture to fit their future homes in real-time and with great ease. My entire 3d application is running on a web browser, using Google Chrome. No fast computers were required

To try this amazing new blueprint tool as an EXE with the scene, or, on a standard web browser (URL link) as seen in the video, simply email me on,
Or, simply Google:

I really hope you have found the video and this new tool useful!