#Trouble with making ADS

1 messages · Page 1 of 1 (latest)

dawn oxide
#

Currently trying to make ADS, it works fine when the model isn't rotated, but as soon as it rotates at all the point where it aims offsets from where the aim part is.

Code for aiming:

-- Aiming
local aimPart = gunModel:FindFirstChild("AimPart"..sightIndex) or gunModel.AimPart
aimTarget = aimPart.CFrame:ToObjectSpace(camera.CFrame)

if aiming then
  aimingOffset = aimingOffset:Lerp(aimTarget,(0.7 / equipped:FindFirstChild("ActiveStats").AimSpeed.Value) * 0.3 * dt * 60)
else
  aimingOffset = aimingOffset:Lerp(CFrame.new(),(0.7 / equipped:FindFirstChild("ActiveStats").AimSpeed.Value) * 0.3 * dt * 60)
end
animBase.CFrame *= aimingOffset

Code for the rotation: (This isn't directly after the aiming code in the full script)

local angle = math.rad(15*-lean)
local rotation = CFrame.Angles(0, 0, angle)
        
animBase.CFrame *= rotation
formal breach
#

I hv the same problem w this b4, I add sum X and Y offset so it goes back to center

wraith lintel
#

apply the lean first than ur aim offset

#

cframe multiplication isn't commutative

elder zodiac
#

^

dawn oxide
wraith lintel