- What do you want to achieve? Keep it simple and clear!
I want my arms to track the camera up and down like in fps games.
- What is the issue? Include screenshots / videos if possible!
It’s behaving in a weird way. Here’s a video :
robloxapp-20231105-1529096.wmv (3.7 MB)
Very confusing stuff.
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried talking to the assistant, but it didn’t give me the info I wanted. I don’t know much about Euler’s angle, so that doesn’t help.
This is my local script (where it happens)
local ps = game:GetService("Players")
local run = game:GetService("RunService")
local player = ps.LocalPlayer
local char = player.Character
local cam = workspace.CurrentCamera
local viewmodelFolder = char:WaitForChild("Viewmodel") --this is created on playerJoined in a server script, works fine
local viewmodelRightArm = viewmodelFolder:WaitForChild("ViewmodelRightArm")
local viewmodelLeftArm = viewmodelFolder:WaitForChild("ViewmodelLeftArm")
local viewmodelCam = viewmodelFolder:WaitForChild("ViewmodelCam")
--variables
--functions
local function renderFunction(deltaTime)
deltaTime = deltaTime
viewmodelLeftArm.LocalTransparencyModifier = 0
viewmodelRightArm.LocalTransparencyModifier = 0
local rz, ry, rx = cam.CFrame:ToEulerAnglesXYZ()
--rz = up and down, rx = left and right
print(math.round(math.deg(rz)))
viewmodelCam:WaitForChild("ToHead").C1 = CFrame.Angles(math.sin(rz) * -1, 0, 0)
end
--methods
run:BindToRenderStep("renderFunction", Enum.RenderPriority.Last.Value + 1, renderFunction)
I tried many ways for the last week and none of them work as intended. Help would be nice, thanks.