VoxelPlugin/VoxelPluginFreeLegacy

Incompatibility of UVoxelProjectionTools::FindProjectionVoxels() with customised collision profile for the VoxelWorld.

alexGuntha opened this issue · 1 comments

Hello,

For reasons I'm not sure I can totally explain myself (it's a big project), we needed to create a specific collision profile for the VoxelWorld to add new capabilities to our camera system.

It turns out this broke the "Flatten" tool in the editor (and some in-game functions that also used UVoxelProjectionTools::FindProjectionVoxels() ), it's adding spheres on top of the pointed terrain instead of behaving properly.

A collision profile was added as below in DefaultEngine.ini:
+Profiles=(Name="PLVoxelWorld",CollisionEnabled=QueryOnly,bCanModify=True,ObjectTypeName="LandscapeObject",CustomResponses=((Channel="LandscapeObject"),(Channel="Paths"),(Channel="CameraFocus")),HelpMessage="Voxel World") [...] +DefaultChannelResponses=(Channel=ECC_GameTraceChannel10,DefaultResponse=ECR_Ignore,bTraceType=False,bStaticObject=False,Name="LandscapeObject")

UVoxelProjectionTools::FindProjectionVoxels() ends up using FCollisionResponseContainer::DefaultResponseContainer with now way to override that (other than ignoring more channels), so a trace with LandscapeObject as the collision channel was behaving as if collisions were ignored.

I had to change this line in Voxel\Private\VoxelTools\VoxelProjectionTools.cpp
const FCollisionResponseContainer ResponseContainer = Parameters.GetResponseContainer();
to
FCollisionResponseContainer ResponseContainer = Parameters.GetResponseContainer(); ResponseContainer.SetResponse(Parameters.CollisionChannel, World->CollisionPresets.GetResponseToChannel(Parameters.CollisionChannel));
as a quick fix to be able to use our collision profile.

I'm pretty sure this is an unhandled case because customising the VoxelWorld's collision profile is not very common, so I'm filing this bug.

Thanks,

Thanks for the bug report!