# Стрельба патронами из пушки

Создать патрон на определённом расстоянии перед пушкой.

```
// создать пульку перед пушкой
GameObject bullet = Instantiate(myBulletPrefab) as GameObject;
bullet.transform.position = transform.TransformPoint(Vector3.forward * 6.4f);
```

Повернуть патрон в направлении дула пушки.

```
// повернуть пульку
Vector3 pos = transform.position - bullet.transform.position;
Quaternion rotation = Quaternion.LookRotation(pos);
bullet.transform.rotation = rotation;
bullet.transform.Rotate(90, 0, 0);
```

Мгновенно добавить силу к пульке.

При этом увеличить вертикальное воздействие силы.

```
// добавить силу к пульке (мгновенно)
Rigidbody rrr = bullet.GetComponent<Rigidbody>();
Vector3 vvv = transform.forward * 5300;
vvv.y = 1115.5f;
rrr.AddForce(vvv);
```


---

# 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/strelba-patronami-iz-pushki.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.
