Hello, I was wondering a question.
Im making a gun kit rn based of older guns like muskets.
These guns didn’t shoot straight the bullet curved down.
I was wondering if their is any way of making a very simple bullet drop system or something to make the bullet after a certain amount of studs curve down
Base is just the parent of the script, ideally it’d be whatever the part you’re shooting the bullet from, and it’ll shoot out the front of it.
if you want to change it, you’d likely want to do something like
local baseCF = CFrameValueThatYouWantToShootFrom --change this to be where you want to shoot from
local step = 0.1
local velocity = baseCF .lookVector * -300
local acceleration = Vector3.new(0,-workspace.Gravity,0)
local start = baseCF.p
local finish = start + velocity * step
local ignore = IgnoreModel --ideally the character of whoever is shooting
local H,P = workspace:FindPartOnRay(Ray.new(start, (finish-start)), ignore)
local i = 0
while H == nil and i < 50 do
local dt = wait(step)
velocity = velocity + acceleration * dt
finish = start + velocity * dt
H,P = workspace:FindPartOnRay(Ray.new(start, (finish-start)), ignore)
start = finish
i = i + 1
end
Recall and keep in mind that the method of integrating the dynamic equations for classical motion is termed “Verlet integration”. You are integrating the equations based on some simulated force (gravity) which causes your downwards acceleration; thus, bullet drop.