Hi, I’m working on a first-person shooter game with a full body for the viewmodel (instead of floating arms) so I divided my viewmodel to two parts: the arms and the rest of the body (thank you random Reddit user that commented this idea on a post from 2015).
My initial plan was to make the body “look towards” the camera but not up and down and the arms just up and down, but I encountered a problem: I can’t change the CFrame of the arms because they are welded with a Motor6D to the body, so I tried to remove the weld and the animations didn’t work, which led me to setting the bone’s CFrame like so:
local cameraCF = camera.CFrame
local cameraLook = cameraCF.LookVector
local rightShoulder = viewModel.HumanoidRootPart.Spine1.Spine2.Spine3["Shoulder.R"]
local rightShoulderPos = rightShoulder.CFrame.Position
rightShoulder.CFrame = CFrame.new(rightShoulderPos, rightShoulderPos + cameraLook)
And the results were… messy and not what I expected at all.
Is there a way to set a part’s CFrame when it’s welded with a Motor6D?
Is there a way to play an animation without Motor6Ds?
If not, what can I do to solve the problem? I really prefer changing the CFrame (or position and rotation) of a part instead of messing with Motor6Ds, but I will settle for it if there’s no other way.
Edit: I tried changing the bone’s CFrame but it lead to messy results as well.
This is in general an annoying problem to solve, there is no easy solution.
Modifying animations/cframe will bring you many issues most likely.
You cannot just “detach” the arms easily like that.
An alternative is that you clone the entire humanoid and play animations for that clone separately.
There is some work involved, but that is the most foolproof way.
The alternative is that you use a pitch animation and the manualy set the play time (where the animation is at): the roblox weapon samples do it like this.
They have an animation which is aiming down at the start and aiming up at the end and then they
set the animation time by lerping the pitch of the camera: this way the animation drives the entire upper body since the animation rotates the character torso, thus the arms also rotate and the character looks up and down.
I don’t want to seperate the rigs completely because it will mess up character customization. I actually didn’t think about that when I seperated them two (into different meshes but they were still under the same model). I think I will join them together again.
The last method sounds extremely cursed, but it sounds like the best solution for my case. I will try that and come back with the result, thank you!
Okay, I am going to be honest, I didn’t think it would work. What in the world?! Why would Roblox do that in their official weapons?! Anyways, it worked! It really did! Thank you.