Author Topic: [Snippet] Find out where your custom voxel (prefab) is located  (Read 328 times)

LittleCodingFox

  • Newbie
  • *
  • Posts: 2
    • View Profile
This is useful for getting information about where a custom prefab voxel is located. I hope it is useful.

Code
        private VoxelPlayEnvironment environment;

        private VoxelChunk selfChunk;
        private Voxel selfVoxel;
        private Vector3 selfPosition;
        private int selfVoxelIndex;

        private void Start()
        {
            environment = VoxelPlayEnvironment.instance;

            selfVoxel = environment.GetVoxel(transform.position);
            selfChunk = environment.GetChunk(transform.position);

            environment.GetVoxelIndex(transform.position, out _, out selfVoxelIndex);

            selfPosition = environment.GetVoxelPosition(selfChunk, selfVoxelIndex);
        }