Answers for "unity world position to isometric"

C#
0

unity world position to isometric

//Give the grid position of a world position    
     public static Node NodeFromWorldPoint(Vector3 world_position)       
         {
             int x = (int)((world_position.x - 2 * world_position.y - node_radius - world_grid_position.x - 2 * world_grid_position.y) / (4 * node_radius));
             int y = (int)((world_position.x + 2 * world_position.y - node_radius - world_grid_position.x - 2 * world_grid_position.y) / (4 * node_radius));
     
             return grid[x, y];
         }
Posted by: Guest on January-19-2021

C# Answers by Framework

Browse Popular Code Answers by Language