Unity 6.3
0 онлайн 77 гостей 3 в системе
Вход

GridLayout.CellToWorld

Declaration

public Vector3 CellToWorld(Vector3Int cellPosition);

Параметры

Параметр Описание
cellPosition Позиция ячейки для преобразования.

Возвращаемое значение

Vector3 Мировое положение позиции ячейки.

Описание

Преобразует позицию ячейки в мировое пространство позиций.

// Snap the GameObject to parent GridLayout
using UnityEngine;

public class ExampleClass : MonoBehaviour { void Start() { GridLayout gridLayout = transform.parent.GetComponentInParent<GridLayout>(); Vector3Int cellPosition = gridLayout.WorldToCell(transform.position); transform.position = gridLayout.CellToWorld(cellPosition); } }