Example #1
0
        private void initGravity(Vector3i coord)
        {
            var block = map[coord];

            var pos  = coord.to_f() - center;
            var dirs = GetGravities(pos, gravityTolerance);

            foreach (var dir in dirs)
            {
                block.SetGravity(dir);
            }

            var gravities = GetGravities(pos, 1.0f);

            if (gravities.Count > 0)
            {
                block.mainGravity = gravities [0];
            }

            if (block.mainGravity.HasValue)
            {
                var nextCoord = coord.NextCoord(block.mainGravity.Value);
                block.hasTop = HasVoxel(nextCoord);
            }
        }