Example #1
0
        public static List <VoxelCollision> InverseCollistionsA(Vector3 positionA, VoxelVolume volumeA, Vector3 positionB, VoxelVolume volumeB)
        {
            var collisions = new List <VoxelCollision>();

            foreach (var kvpA in volumeA.Data)
            {
                var worldVoxelA = GetWorldVoxelFromLocalVoxel(positionA, kvpA.Key - volumeA.Pivot);
                var localVoxelB = GetLocalVoxelFromWorldVoxel(positionB, worldVoxelA + volumeB.Pivot);
                if (!volumeB.HasVoxelAt(localVoxelB))
                {
                    collisions.Add(new VoxelCollision
                    {
                        WorldPos  = worldVoxelA,
                        LocalPosA = kvpA.Key,
                        LocalPosB = localVoxelB
                    });
                }
            }
            return(collisions);
        }
Example #2
0
        public static bool IsInVoxelVolume(Vector3 point, Vector3 objPosition, VoxelVolume volume)
        {
            var voxelPos = GetWorldVoxelFromWorldPos(point);

            return(volume.HasVoxelAt(GetLocalVoxelFromWorldVoxel(objPosition, voxelPos + volume.Pivot)));
        }