Hello,
I was looking pretty much everywhere for this and was pretty surprised I couldn’t find it anywhere.
I need to make a script that moves the arms up/down depending where the player is looking, so when in first person it looks similar to how a viewmodel would look like. I’m not very good with math, especially trigonometry so I’m in a tough spot. Tried using AI generated code, which got somewhat close to what I needed but not quite there.
Video below is recorded in Criminality as an example:
Also:
I AM NOT LOOKING ON HOW TO MAKE A VIEWMODEL (FAKE ARMS)
To make a viewmodel in first person look wherever the player looks, that requires no math. Basic CFrame knowledge to be honest, all you need to do is set the viewmodel’s rootjoint (e.g. humanoidrootpart) to the cam.CFrame, then offset it to make it look realistic (around the arms)
local RunService = game:GetService("RunService")
local ViewModel = game.ReplicatedStorage.ViewModel:Clone()
local Camera = workspace.CurrentCamera
ViewModel.Parent = Camera
RunService.RenderStepped:Connect(function()
ViewModel.HumanoidRootPart.CFrame = Camera.CFrame * CFrame.new(x,y,z)
end)
The easy method would be to create your own viewmodel in studio, then do make it match the player’s bodycolors/clothing you can loop through the player’s character and parent the bodycolor/clothing to the rig (this will work as long as everything is rigged properly).
Also ensure you connect the parts together via motor6ds, they have the same behaviour as weldconstraints. Except with motor6ds, you can also add animations onto the arms, welds won’t allow this.
Third person is pretty easy too, I think you need to use bodygyros. Make the arms align the camera’s CFrame. Boom.
By the way you don’t need to parent the cloned viewmodel to the camera but it’s just feels cleaner imo.
Update: (Alignorientation is the new method, bodygyros are easier though)
You can see in that video that you showed, its just the arms + head that are getting aligned. It is literally the same proccess but with an extra body part.
Look this is my viewmodel, the arms move up and down depending on where the player is looking. using basically the similiar code sample i gave you.
(Skip to 0:36-0:42 to see the arms moving up and down depending on where the player looks)