Soo, i made a Viev Model, you can aim with it, but the problem is that AimPart (part to which gun teleports) is not precise, this mean i need to move it to make player aim in good spot
Note: I used EgoMoose’s code for lerping and adjusted offset to my system
- State is true/false depending on input
- Tool.Part1 is tool’s handle
- Tool.Part0 is VievModel’s Torso
- VievModel’s primary part is his head
Code:
local offset = ((CurrentViewModel.Tool.Aim.CFrame:Inverse() * CurrentViewModel.Tool.Handle.CFrame):Inverse() * CurrentViewModel.VievModel.Torso.Tool.C1) -- here is problem
local start = CurrentViewModel.VievModel.Torso.Tool.C0
local goal = state and offset or CFrame.new()
aimCount = aimCount + 1
local current = aimCount
for t = 0, 101, 10 do
if (current ~= aimCount) then break end
game:GetService("RunService").RenderStepped:Wait()
CurrentViewModel.VievModel.Torso.Tool.C0 = start:Lerp(goal, t/100)
end
This is better visualization of what i mean
IDK how i can fix this, can anyone help?