Dear Friends at Epic,
I wrote this function and think it would be a fun addition to your FBox.h library
It would make for a great constructor overload
//Box from World Space Center and Size
FORCEINLINE FBox BoxFromPointWithSize(const FVector& InCenter, const float& Size)
{
return FBox(
InCenter+(FVector(1,1,1) * -Size/2),
InCenter+(FVector(1,1,1) * Size/2)
);
}
#Summary
Simple additional constructor to make a 3D box from a single point the box is centered around, and the desired size of the box
#Pic of my Vertex Snap Editor Plugin
I used the above function for one of the drawing modes of verticies in my [Vertex Snap Editor Mode Plugin][1]
Enjoy!
Rama
Hi Rama,
An exploratory remark, this kind of reminds me of voxel technology.
hee hee!
Actually InstancedStaticMeshComponents are really good for voxel-like stuff
I got upwards of 4000 3d cubes on screen without much slowdown of any kind!
Rama
Hi Rama,
It’s not exactly the same, but check out
static FBox BuildAABB( const FVector& Origin, const FVector& Extent )
in Box.h. Same base concept, but allows for non-square boxes.
Cheers!
Jeff
ahhh I did not see that one !
I was hoping for a constructor that took in a point and a size/extent
FBox NewBox(Origin - Extent, Origin + Extent);
“BuildAABB” is not as intuitive for me as FBox(Center,Extent)
It’s a minor point but I consider it my rocket-tester-duty to report what I consider to be greater convenience usage of base classes
just turning BuildAABB() into a overloaded constructor would be more than sufficient
Thanks Jeff!
Rama
That’s a good suggestion, but unfortunately we already have a constructor matching that signature that takes the corners.
FBox( const FVector& InMin, const FVector& InMax )
So we can’t add a Center/Extent overload. That said, your
FBox NewBox(Origin - Extent, Origin + Extent);
syntax looks like a pretty clean approach to me.
Jeff
“we already have a constructor matching that signature that takes the corners.”
ahh that’s a good point,
well this then is my last comment hee hee,
THIS constructor signature is not taken, the one I originally posted, hee hee!
FBox( const FVector& Center, const float& Size )
Yes it limits you to a cube but that was the basis of my original post anyways, fast way to make squares/cubes
Nice to hear from you Jeff!
Rama