generated from max/template-unity-project
SceneGrid SceneView test
This commit is contained in:
@ -16,7 +16,7 @@ namespace VertexColor.ScenePartition.Editor
|
||||
|
||||
public void Insert(uint id, Vector3 point)
|
||||
{
|
||||
int gridId = CalculateGridPosition(point);
|
||||
int gridId = CalculateGridPosition(point, cellSize);
|
||||
if (grid.TryGetValue(gridId, out List<uint> ids))
|
||||
{
|
||||
ids.Add(id);
|
||||
@ -27,7 +27,7 @@ namespace VertexColor.ScenePartition.Editor
|
||||
}
|
||||
}
|
||||
|
||||
public int CalculateGridPosition(Vector3 point)
|
||||
public static int CalculateGridPosition(Vector3 point, int cellSize)
|
||||
{
|
||||
int x = Mathf.FloorToInt(point.x / cellSize);
|
||||
int z = Mathf.FloorToInt(point.z / cellSize);
|
||||
|
Reference in New Issue
Block a user