- What do you want to achieve?
In order to Walk animations for my Viewmodel
- What is the issue?
Current Viewmodel not load walk animations
Here Video of Viewmodel:
And here video without Viewmodel:
- What solutions have you tried so far?
Asking my Friends and try to find solutions on DevForum
Here my script
--Settings--
local SmoothMult = 1
local O = 0.2 --Front/Back--
local X = 0 --Left/Right--
local Y = 0 --Up/Down--
--Local--
local RunService = game:GetService("RunService")
local Character = script.Parent
wait(2)
local VM = game.ReplicatedStorage.ViewModelStorage.VM:Clone()
VM.Parent = workspace.CurrentCamera
local LeftShoulder = Character.Torso["Left Shoulder"]
local RightShoulder = Character.Torso["Right Shoulder"]
--Script1--
function getCFrame(cframe)
local sx, sy, sz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = cframe:GetComponents()
local X = math.atan2(-m12, m22)
local Y = math.asin(m02)
local Z = math.atan2(-m01, m00)
return X,Y,Z
end
--Script2--
RunService.RenderStepped:Connect(function(deltatime)
Character:FindFirstChild("Right Arm").LocalTransparencyModifier = 0
Character:FindFirstChild("Left Arm").LocalTransparencyModifier = 0
local pcframe = workspace.CurrentCamera.CFrame + workspace.CurrentCamera.CFrame.LookVector * O + workspace.CurrentCamera.CFrame.RightVector * X + workspace.CurrentCamera.CFrame.UpVector * Y
local lerpedRot = VM.PrimaryPart.CFrame:lerp(pcframe,SmoothMult)
local _,_,_,m11,m12,m13,m21,m22,m23,m31,m32,m33 = lerpedRot:components();
local ogPos = pcframe.p;
local newCf = CFrame.new(ogPos.x,ogPos.y,ogPos.z,m11,m12,m13,m21,m22,m23,m31,m32,m33)
VM.PrimaryPart.CFrame = newCf;
--Distance--
local dist = (workspace.CurrentCamera.CFrame.Position - Character.Head.Position).Magnitude
if dist < 1 then
RightShoulder.Part0 = VM.Torso
LeftShoulder.Part0 = VM.Torso
else
RightShoulder.Part0 = Character.Torso
LeftShoulder.Part0 = Character.Torso
end
end)
Thanks guys if u reading this and help me