Post reply

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.
Name:
Email:
Subject:
Message icon:

shortcuts: hit alt+s to submit/post or alt+p to preview


Topic Summary

Posted by: LittleCodingFox
« on: November 01, 2020, 12:28:28 AM »

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);
        }