> For the complete documentation index, see [llms.txt](https://maxim218.gitbook.io/unity/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://maxim218.gitbook.io/unity/chapter1.md).

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

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

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

```
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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
