I have a rocket launcher weapon where the rocket intermittently does not fly to the correct position. In some cases, for whatever reason, it flies down and to the left. See the video for illustration.
The projectile has it’s own script, but this is the code that determines the direction:
local position = toolInstance.Handle.CFrame * toolData.weapon.barrelOffset
local direction = (hitPos - position).Unit
part.CFrame = CFrame.new(position, hitPos)
part.Velocity = direction * toolData.weapon.projectile.speed
Now I have added a raycast to this and the result position of the raycast is exactly the same location as the hitPos (clicked location). But when the projectile hits, the impact position is off.
local result = game.Workspace:Raycast(position, direction * 2500, nil)
I do have a vector force that counteracts gravity. It is on the projectile so it’s cloned as well. I know it works because the projectile doesn’t fly into the ground.
Any ideas?