Hey all,
I’ve been reading and following Egomoose’s tutorial on viewmodels, and I am looking to setup my own system of using animations rather than calculating the c1 for the arms… I’m trying to get the arms to sway with the gun right now:
https://gyazo.com/0ee0320af5c436e541396c6a19d4458d
Current Code:
local function updateArm(self, key)
if (self[key]) then
local shoulder = self.isR15 and self.viewModel["Head"][key.."Shoulder"]
local cf = self.weapon[key].CFrame * CFrame.Angles(0, 0, 0)
shoulder.C1 = shoulder.C1 --i don't know what to do here
end
end
Original code:
local function updateArm(key)
-- get shoulder we are rotating
local shoulder = viewModel[key.."UpperArm"][key.."Shoulder"];
-- calculate worldspace arm cframe from Right or Left part in the weapon model
local cf = weapon[key].CFrame * CFrame.Angles(math.pi/2, 0, 0) * CFrame.new(0, 1.5, 0);
-- update the C1 value needed to for the arm to be at cf (do this by rearranging the joint equality from before)
shoulder.C1 = cf:inverse() * shoulder.Part0.CFrame * shoulder.C0;
end
Tutorial: The First Person Element Of A First Person Shooter
Here’s an attached place file: FPS_Ego.rbxl (413.7 KB)
Thanks