DrawDebugIntBox Blueprint node draws with an offset for cubic voxel worlds
jdies opened this issue · 2 comments
jdies commented
Setup
UE 4.26 (source)
First person template
VoxelPlugin free, downloaded today (12.09.21) from here https://drive.google.com/drive/folders/1qzTSk_vdp-niSOmi3syL0yOAGiftvx3x
Blueprint
Also tested with supplying the transform of VoxelWorld
to DrawDebugIntBox
. Same result.
Result
Expected
Edited bounds should not be offset. It should look like an outline of the filled voxel.
jdies commented
Closing after discussion on Discord.
Phyronnaz — Today at 2:04 PM
Its just that it doesn't work great with cubic due to the cubes being offset by half a voxel
jdies commented
Workaround
I only use cubic in my project, so I can just modify the C++ code and offset DrawDebugIntBox by .5 voxels.
This works for me (voxel size is 200)
void UVoxelDebugUtilities::DrawDebugIntBox(
const FVoxelCoordinatesProvider& World,
UVoxelLineBatchComponent& LineBatchComponent,
FTransform Transform,
FVoxelIntBox Box,
float Lifetime,
float Thickness,
FLinearColor Color)
{
VOXEL_FUNCTION_COUNTER();
// Put it in local voxel world space
const FVector Min = LineBatchComponent.GetComponentTransform().InverseTransformPosition(World.LocalToGlobal(Box.Min)) - FVector(World.GetVoxelSize() * 0.45f);
const FVector Max = LineBatchComponent.GetComponentTransform().InverseTransformPosition(World.LocalToGlobal(Box.Max)) - FVector(World.GetVoxelSize() * 0.45f);
const FBox DebugBox(Min, Max);
DrawDebugBox(LineBatchComponent, Transform, DebugBox, Lifetime, Thickness, Color);
}
Cool