Currently my script points the gun towards the center of the screen when the ADS is activated, this works fine except the view of down the scope is slightly too high so the bullets are hitting below where the scope is aiming, I have tried tweaking the joint and the angle for the ADS but I can't seem to change the height of the aiming without the ADS being uncentered and weird.
https://gyazo.com/b75efbcaafb16afc4ba21908c04265f9
#Aiming down sights on gun slightly too high, unsure of how to properly adjust height/angle
16 messages · Page 1 of 1 (latest)
on the clip you can see the bullets are hitting in front of the barrel rather than where the scope is pointing
local function ADS(aiming)
local start = joint.C1
local goal = aiming and joint.C0 * offset or CFrame.new()
aimCount = aimCount + 1;
local current = aimCount;
for t = 0, 102, 10 do
if (current ~= aimCount) then break; end
game:GetService("RunService").RenderStepped:Wait();
joint.C1 = start:Lerp(goal, t/100);
end
end
oh I agree, the bullets are actually fired through a raycast originating from the head.CFrame
they go toward the mouse.Hit.Position so I was wondering if there was a way to adjust my angle so the scope is actually in line with the mouse
np
that is a good idea, I tried adding the aim part as my joint part1 however the gun appears very low on the screen now, very confusing
local function ADS(aiming)
joint.Part1 = gun.Aim
local start = joint.C1
local goal = aiming and joint.C0 * offset or CFrame.new()
aimCount = aimCount + 1;
local current = aimCount;
for t = 0, 102, 10 do
if (current ~= aimCount) then break; end
game:GetService("RunService").RenderStepped:Wait();
joint.C1 = start:Lerp(goal, t/100);
end
end
got it, the offset was messing it up, after setting the aim to the joint part1 i could then rotate the aim part to get the perfect angle, thanks for your help 🙂
wow that is really cool man! definitely will have a look into that
** You are now Level 6! **
the only problem I am currently dealing with us that the transition from aiming to not aiming seems to glitch
I believe this is caused by the gun starting the lerp at the head and moving back down to the starting position but I cant seem to spot where this is coming from hmm
local offset = gun.Aim.CFrame:Inverse() * gun.Handle.CFrame
local start
local goal
if aiming then
joint.Part1 = gun.Aim
start = joint.C1
goal = aiming and joint.C0 or CFrame.new()
else
joint.Part1 = gun.Handle
start = joint.C1
goal = aiming and joint.C0 * offset or CFrame.new()
end
aimCount = aimCount + 1;
local current = aimCount;
for t = 0, 102, 10 do
if (current ~= aimCount) then break; end
game:GetService("RunService").RenderStepped:Wait();
joint.C1 = start:Lerp(goal, t/100);
end
nvm got it sorted