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!!