I am trying to make FPS-styled arms, but they are very laggy. I have an R15 rig that I weld to the player’s head locally, and each render stepped, I change the C0 of the weld so that the arms stay on the player’s screen. Does anyone have any idea why it is so laggy?
local Inst_rep = game.Workspace.Rep:Clone() -- the R15 rig that I weld (I deleted its legs)
local Inst_w = Instance.new("Weld")
Inst_w.Part0 = Inst_character.Head
Inst_w.Part1 = Inst_rep.Head
Inst_w.Parent = Inst_character.Head
Inst_rep.Parent = game.Workspace
RunService.RenderStepped:Connect(function()
Inst_w.C0 = Inst_character.Head.CFrame:Inverse()*(Inst_cam.CFrame)*CFrame.new(0,0,-1)
end)
You should do this in a localscript and put it in playerstarterscripts, or you can connect the playerAdded event and fire this code when a player is added
Just setting the camera to scriptable means that I need to make my own camera script, which doesn’t sound like a whole lot of fun to me… Also, I’m not how making a custom camera script would solve the issue of the camera being too slow.
I just found a video. I haven’t watched it though, but I think it might help
— EDIT —
The video just makes the arms untransparent. You can then lock the person in first player mode as I suggested in one of my posts above
— Another EDIT —
I found some info about LocalTransparencyModifier, the one they used in the video
Interpolation might be a bit iffy since I’m changing the C0 every RenderStepped. I will try though.
Edit: Interpolation kinda yields the same results. Good idea though.
I’m going on a limb and guessing you might be able to curve some of the issues by using the DT parameter to keep track of time.
Does the same issue occur if you use something like Heartbeat instead?
If you want something a little more legible. (Assuming you meant to do (CFrame:Inverse()*CFrame) * CFrame
Otherwise move the parenthesis appropriately
Might be slightly faster too since it gets calculated in 1 func call and 1 multiplication instead of 1 func call and 2 multiplications
Another thing to do is set the CFrame of the Head of the rig to the camera’s CFrame. This involves less math, and the article where I found it is here: The First Person Element Of A First Person Shooter