Tilemap.GetCellCenterWorld publicVector3GetCellCenterWorld(Vector3Intposition); 参数 position网格单元格位置。 返回 Vector3变换为世界空间坐标的单元格中心。 描述 获取世界空间中网格单元格的逻辑中心坐标。 在矩形网格布局中,使用Vector3Int参数对GridLayout.CellToWorld进行的调用会返回表示单元格左下角的Vector3...
publicVector3GetCellCenterWorld(Vector3Intposition); 参数 position网格单元格位置。 返回 Vector3变换为世界空间坐标的单元格中心。 描述 获取世界空间中网格单元格的逻辑中心坐标。 在矩形网格布局中,使用Vector3Int参数对GridLayout.CellToWorld进行的调用会返回表示单元格左下角的Vector3坐标。这在数学上是正确的,...
public Vector3 GetCellCenterWorld (Vector3Int position); 参数 position 网格单元格位置。 返回 Vector3 变换为世界空间坐标的单元格中心。 描述 获取世界空间中网格单元格的逻辑中心坐标。 在矩形网格布局中,使用 Vector3Int 参数对 GridLayout.CellToWorld 进行的调用会返回表示单元格左下角的 Vector3 坐标。
Tilemap.GetCellCenterWorld public Vector3 GetCellCenterWorld (Vector3Int position); 参数 position 网格单元格位置。 返回 Vector3 变换为世界空间坐标的单元格中心。 描述 获取世界空间中网格单元格的逻辑中心坐标。 在矩形网格布局中,使用 Vector3Int 参数对 GridLayout.CellToWorld 进行的调用会返回表示单...
public Vector3 GetCellCenterWorld (Vector3Int position); 参数 position 网格单元格位置。 返回 Vector3 变换为世界空间坐标的单元格中心。 描述 获取世界空间中网格单元格的逻辑中心坐标。 在矩形网格布局中,使用 Vector3Int 参数对 GridLayout.CellToWorld 进行的调用会返回表示单元格左下角的 Vector3 坐标。
// Snap the GameObject to parent Grid center of cell using UnityEngine;public class ExampleClass : MonoBehaviour { void Start() { Grid grid = transform.parent.GetComponent<Grid>(); Vector3Int cellPosition = grid.WorldToCell(transform.position); transform.position = grid.GetCellCenterWorld(cell...
Grid.GetCellCenterWorld public Vector3 GetCellCenterWorld (Vector3Int position); Parameters position Grid cell position. Returns Vector3 Center of the cell transformed into world space coordinates. Description Get the logical center coordinate of a grid cell in world space. In a rectangular gri...
// Snap the GameObject to parent Grid center of cell using UnityEngine;public class ExampleClass : MonoBehaviour { void Start() { Grid grid = transform.parent.GetComponent<Grid>(); Vector3Int cellPosition = grid.WorldToCell(transform.position); transform.position = grid.GetCellCenterWorld(cell...
Grid.GetCellCenterWorld public Vector3 GetCellCenterWorld (Vector3Int position); Parameters position Grid cell position. Returns Vector3 Center of the cell transformed into world space coordinates. Description Get the logical center coordinate of a grid cell in world space. In a rectangular gri...