# Базовые операции

## Вывод в консоль

Вывод сообщений в консоль

```
Debug.Log("String First");
Debug.Log("String Second");
Debug.Log("String Third");
```

## Движение и вращение локально

Движение с учётом текущего угла поворота

```
transform.Translate(0, 0, speedMove * Time.deltaTime);
transform.Rotate(0, speedRotating * Time.deltaTime, 0);
```

## Движение и вращение глобально

Движение в глобальном мире

```
transform.Translate(0, 0, speedMove * Time.deltaTime, Space.World);
transform.Rotate(0, speedRotating * Time.deltaTime, 0, Space.World);
```

## Движение объекта в направление цели

```
void Update () {
   GameObject targerGameObject = GameObject.Find("Sphere");
   float speed = 4.2f;
   transform.position = Vector3.MoveTowards(transform.position, targerGameObject.transform.position, speed * Time.deltaTime);
}
```

## Получение положения объекта

```
Vector3 pos = gameObject.transform.position;
string s = pos.x + "  " + pos.y + "  " + pos.z;
Debug.Log(s);
```

## Получение расстояния между объектами

```
GameObject person_1 = gameObject;
GameObject person_2 = GameObject.Find("Sphere");
float d = Vector3.Distance(person_1.transform.position, person_2.transform.position);
Debug.Log(d);
```

## Повернуться лицом к цели

```
Vector3 pos = GameObject.Find("Sphere").transform.position - transform.position;
Quaternion rotation = Quaternion.LookRotation(pos);
transform.rotation = rotation;
```

## Получить угол поворота по оси Y

```
float yyy = gameObject.transform.rotation.y;
Debug.Log(yyy);
```

## Изменение координат точки

```
Vector3 p = new Vector3(0, 0, 0);
p.x = 14;
p.y = 3;
p.z = 6;
gameObject.transform.position = p;
```

## Режим во весь экран

Сделать приложение во весь экран.

```
Screen.fullScreen = true;
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://maxim218.gitbook.io/unity/chapter1.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
