CFrame troubles

Hello, i was making an omni directional movement system (like bo6 or helldivers 2 or battlefield 6) with a gun system and realized that the arms were clipping through the ground. I implemented a script

below script does not do anything with the head, still uses camera

if char.Torso:FindFirstChild("Neck") then
	char.Torso["Neck"].C0 = char.Torso["Neck"].C0:Lerp(CFrame.new(0, 1, 0) * CFrame.Angles(-math.asin((m.Origin.p - m.Hit.p).unit.y) + 1.55, 3.15, 0), 0.2)
end

if char.Torso:FindFirstChild("Right Shoulder") then
	char.Torso["Right Shoulder"].C0 = char.Torso["Right Shoulder"].C0:Lerp(CFrame.new(1, 1, 0) * CFrame.Angles(-math.asin((m.Origin.p - m.Hit.p).unit.y), 1.55, char.Torso["Neck"].C0.Position.Y, 0) , 0.1)
end

if char.Torso:FindFirstChild("Left Shoulder") then
	char.Torso["Left Shoulder"].C0 = char.Torso["Left Shoulder"].C0:Lerp(CFrame.new(-1,1, 0) * CFrame.Angles(-math.asin((m.Origin.p - m.Hit.p).unit.y), -1.55, -char.Torso["Neck"].C0.Position.Y, 0) , 0.1)
end

that would of fixed this. however the left and right shoulder are making it weird by still clipping and my bruteforcing technique with cframes is pretty bad. Can anyone give and possibly explain a solution to just having the arms simply rotate with the head (not the camera)

TLDR
I want the arms of the character to rotate with the HEAD, not the CAMERA. I tried using pivotto on the arms and it kinda worked but my character was flinged.

sorry im kinda new to this cframe math stuff!!

1 Like

i feel like i didnt explain properly so ill explain properly.

I want the arms to rotate up or down. They would be angled in correspondence to the angle of the head

If i was looking up, my arms should also be looking up. same thing with down. This would allow it to apply anywhere without troubles

To anyone who’s questioning why not just use the camera, well when the character is prone the camera still remanins in the same position.. therefore no movement is done on the arms. With the head it always moves with it, meaning if the character is prone and looking forwards the arms would also do that.

Thank you, and good night.

1 Like

bump

thirty-characters fo sureeeeeeeeee

1 Like