Is this possible?
I want all bodyparts to move EXCEPT for the legs.
Like how R15’s Upper Torso functions.
That’s cool, but I’m not too good at scripting or math. I’m not really sure how to understand this.
Let me try to represent it further by breaking it down. This took me months to learn and I learnt it by piecing together code like search “How to make your arm point at mouse”
Before any changes, the C0 remains at constant rotation so nothing is unchanged.
local WaistOriginC0 = Waist.C0
RunService.RenderStepped:Connect(function()
local CameraCFrame = Camera.CoordinateFrame
--local rotationWaistCFrame = CFrame.Angles(math.rad(90),0,0)
local rotationWaistCFrame = CFrame.new()
local goalWaistCFrame = rotationWaistCFrame*WaistOriginC0
Waist.C0 = goalWaistCFrame.Rotation + WaistOriginC0.Position
Then you add a rotation of 90 degrees on the waist “global” x axis, by global I mean not really global in the rotation along (1, 0, 0) relative to origin axis, but not using the CFrame Rotation axis already present in the WaistOriginC0
local rotationWaistCFrame = CFrame.Angles(math.rad(90),0,0)
local goalWaistCFrame = rotationWaistCFrame*WaistOriginC0
The “global X axis” is visualized there and the rotation direction using the Right hand curl rule for vector rotations,
Also be aware order matters and swapping it will get you a different result, this rotates the WaistOriginC0 by the local X axis within the original C0 CFrame which is in a different direction, infact it’s the opposite:
local goalWaistCFrame = WaistOriginC0*rotationWaistCFrame
The important bit and the confusing one is the last one applying the counter inverse rotation.
TBH IDK how I came up with it I believe I just tried applying the inverse rapidly and change the order and permutation of the multiplication. But definitely :Inverse() was needed to apply the opposite rotation that was done to the root torso onto the legs.
Also the code below doesn’t rely on the previous rotation code just the C0 and a constant which is the origin C0 which was the C0 before any changes were done.
local currentLegCounterCFrame = Waist.C0*(WaistOriginC0:Inverse())
local legsCounterCFrame = currentLegCounterCFrame:Inverse()
RHip.C0 = legsCounterCFrame*RHipOriginC0
LHip.C0 = legsCounterCFrame*LHipOriginC0
Funny result lol:
Thank you so much for explaining it to me. It’s so much clearer now.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.