VoxelPlugin/VoxelPluginFreeLegacy

VoxelProjectionTools::FindProjectionVoxels not calculating direction properly

swhcgh opened this issue · 2 comments

I may be using origin/direction wrong, if that's the case this may be a non-issue.

I'm feeding in two vectors (some small distance apart), and normalizing the Direction vector gives the same direction no matter what the actual direction is.

I fixed this locally with these changes:

VoxelProjectionTools.cpp 274-278

// if (!Direction.Normalize())
	// {
	// 	FVoxelMessages::Error(FUNCTION_ERROR("Invalid Direction!"));
	// 	return 0;
	// }

	Direction = Direction - Position;

VoxelProjectionTools.h 170
// if (!ensure(Direction.IsNormalized())) return 0;

Given the possibility I may simply be using this wrong, and removing validating steps, I won't submit this as a pull request.

This probably affects the other Projection methods as well.

Yup you're likely passing the wrong value here - Direction is supposed to be an unit vector, not a location

That works, thanks! I'll ask in Discord next time.