How to create an r6 arm sway: like hellmet or bodycam

  1. I’m in the progress of creating a bodycam shooter game heavily inspired by ready or not, my idol dev sensei, and the game bodycam (purchased on steam.) I’m trying to achieve the ability for the arms to move freely, not like a ragdoll but sort of like free hand. Once the player aims the cursor / aim should be centered and the arms should be in the same spot aiming like a cop would.

  2. I have tried, but I’m not that experienced in coding so yeah.

  3. **I’ve tried tweaking my code, and yes, I did look for solutions all around the devforum and everywhere, but I cannot understand how to do it. I would
    like some guiding on how to achieve this effect. **

--General Updating--
runService.RenderStepped:Connect(function()
	--Arm and character pointing towards mouse stuff--
	if equipped == true and mouse.Hit.Position ~= nil and currentCharacter ~= nil then
		local rightX, rightY, rightZ = currentCharacter.Torso["Right Shoulder"].C0:ToEulerAnglesYXZ()
		currentCharacter.Torso["Right Shoulder"].C0 = (currentCharacter.Torso["Right Shoulder"].C0 * CFrame.Angles(0, 0, -rightZ)) * CFrame.Angles(0, 0, math.asin((mouse.Hit.p - mouse.Origin.p).unit.y))
		tweenService:Create(currentCharacter.Torso["Right Shoulder"], TweenInfo.new(0.2), {C0 = (currentCharacter.Torso["Right Shoulder"].C0 * CFrame.Angles(-rightX, 0, -rightZ)) * CFrame.Angles(0, 0, math.asin((mouse.Hit.p - mouse.Origin.p).unit.y))}):Play()
		local leftX, leftY, leftZ = currentCharacter.Torso["Left Shoulder"].C0:ToEulerAnglesYXZ()
		currentCharacter.Torso["Left Shoulder"].C0 = (currentCharacter.Torso["Left Shoulder"].C0 * CFrame.Angles(0, 0, -leftZ)) * CFrame.Angles(0, 0, math.asin((-mouse.Hit.p - -mouse.Origin.p).unit.y))
		tweenService:Create(currentCharacter.Torso["Left Shoulder"], TweenInfo.new(0.2), {C0 = (currentCharacter.Torso["Left Shoulder"].C0 * CFrame.Angles(-rightX, 0, -leftZ)) * CFrame.Angles(0, 0, math.asin((-mouse.Hit.p - -mouse.Origin.p).unit.y))}):Play()
	end
	
	--Crosshair updater--
	if equipped == true and currentCrosshair ~= nil then
		currentCrosshair.Crosshair.Position = UDim2.fromOffset(mouse.X, mouse.Y)
	end
end)

this is the code I have so far for the arms to only go up and down, and it’s not very smooth. I would like it to go all around, freely.

2 Likes

You could consider using IKControl. Essentially you’d cast a ray to the mouse direction and move for example an Attachment to that location. Then set the IKControl to look at the attachment.

Hopefully this helps you get started :smiley:

hm ok, I don’t know much but I will have to learn.

I believe you are referring to sway, hope this post below helps:

That is almost what I’m looking for, I just want the arms to you know, not really sway. They should, but it should be more like not springy, the arms should follow the cursor all angles, and then once you right click it goes back to the exact center. Sort of like the game hellmet. I will forsure tweak around with this, because it seems pretty neat. Thanks though!

Note: This is not a viewmodel, this is an animated gun with r6 movements.