Hello, I just started working with UE and i created a My_Mesh = CreateDefaultSubobject(TEXT(“MyMesh”));
Is there a way i can get the size of mesh ? i need to get x,y,z to subdivide the map into squares, triangles and hexagones to create my own custom navigation mesh.
I found out about these
“GetComponentBounds” for components
“GetActorBounds” for Actors.
And i dont understand how to use them.
FTransform transform ;
FVector vector = My_Mesh->CalcBounds(transform ).GetBox().GetSize();
this returns negative values. I am not sure if this is the correct way of getting the size. Also what is the transform needed for, is it the a transform that will get a value when i call calcBounds, or is the function CalcBonds calculating the bounds of the transform ?
SphereRadius returned 536870912
and BoxExtent returned negative values
When you call UStaticMeshComponent::CalcBounds(FTransform& LocalToWorld), first the bounds of the mesh are fetched, and then they are transformed by the LocalToWorld transform. So when you have a transform with a location and a rotation, the bounds are translated and rotated.
Also notice that the mesh of the UStaticMeshComponent must be set first.