Hey everyone
For more than a hour I've been trying to create a projectile which would fire at the opposite side of a vehicle (let's say I have an Infernus facing front, but I want for the projectile to shoot from the side to the car and not to the front (think of it as a pirate ship broadside cannon), or another explantation: Let's say my vehicle is facing North, but I want the projectile to be shot at West)
local veh = getPedOccupiedVehicle(getLocalPlayer())
local x, y, z = getElementPosition(veh)
local rX, rY, rZ = getElementRotation(veh)
local x = x + 4 * math.sin(math.rad(rZ + 90))
local y = y + 4 * math.cos(math.rad(rZ + 90))
createProjectile(veh, 19, x + 3.5, y + 3.6)
This is the base code I'm working with. I've tried to change the rotation and velocity of the projectile, which worked, however, only if the vehicle was facing a certain direction otherwise the projectile just destroyed the vehicle.
Please, I'm been trying to do this for more than a hour and would be grateful if you could help me.