Hello Developers.
I want to add an aim down iron sight system by pivoting my arms object with an offset and TweenService to animate the aim.
I’ve done some research and I cant seem to find any good solution.
I’m using this attachment to where I want the arms to offset to that attachment where it goes to the camera
self.connection = RunService.RenderStepped:Connect(function(deltaTime)
--self.Arms:PivotTo(workspace.Camera.CFrame)
local Delta = UserInputService:GetMouseDelta()
SwaySpring:shove(Vector3.new(-Delta.X/500, Delta.Y/500, 0))
BobSpring:shove(Vector3.new(bob(5), bob(10), bob(5)) / 10 * (game.Players.LocalPlayer.Character.PrimaryPart.Velocity.Magnitude) / 10)
if UserInputService:IsMouseButtonPressed(Enum.UserInputType.MouseButton2) then
--aim()
end
local UpdatedSway = SwaySpring:update(deltaTime)
local UpdatedBob = BobSpring:update(deltaTime)
self.Weapon:PivotTo(
workspace.CurrentCamera.CFrame *
CFrame.new(UpdatedSway.X, UpdatedSway.Y, 0) *
CFrame.new(UpdatedBob.X, UpdatedBob.Y, 0)
)
end)
If you have any ideas on how to calculate this offset or questions let me know please!