# How to manage Projectiles !!

## Recommended Posts

Hi there,

I want to ask if there is any way to manage the direction of the rocket created by

```createProjectile
```

function !

because i made a script using this function the rocket dont go to the correct direction ! I use

```setCameraMatrix
```

it s work but when i move its failed !

Just read the wiki, there are rotational arguments "rotX, rotY, rotZ: float starting rotation for the projectile.". IF you mean changing the direction after the rocket is fired i don't think that's possible.

I already read the wiki I m here firing at a specific x, y, z coordonation

What do you want to do with setCameraMatrix?

well I just use it to correct the direction of the rocket and it s work only when I m idle

```getElementPosition
getElementMatrix
getElementRotation
```

this won't help

```setCameraMatrix
```

How this will help give me example please

my formatting sucks but here's one example

```bindKey("vehicle_fire", "down", function()
local assholeinvehcile = getPedOccupiedVehicle(getLocalPlayer())
local x, y, z = getElementPosition(assholeinvehcile)
local m = getElementMatrix(assholeinvehcile)
local offX = 0 * m[1][1] + 1 * m[2][1] + 0 * m[3][1] + 1 * m[4][1]
local offY = 0 * m[1][2] + 1 * m[2][2] + 0 * m[3][2] + 1 * m[4][2]
local offZ = 0 * m[1][3] + 1 * m[2][3] + 0 * m[3][3] + 1 * m[4][3]
vx = offX - x
vy = offY - y
vz = offZ - z
local rotx, roty, rotz = getElementRotation(assholeinvehcile)
createProjectile(getLocalPlayer(), 19, x+1, y-0.5, z+0.8, 5000, nil, 0, 0, 360 - rotz, vx, vy, vz) ------- not sure on which angle it is firing, just edit it.
end)
```

## Create an account

Register a new account