I don’t think you understand how lerp works, it returns a + (b - a) * c (if I remember correctly). 1:lerp(2, 0.5) would return 1.5.
Yes, lerp doesn’t assign a value, it returns a value.
Im literally doing all of this, Its not working
config.RunService.RenderStepped:Connect(function(dt)
--Arms.PrimaryPart.CFrame = config.Camera.CFrame This works but not the Intended effect
--config.TweenService:Create(Arms.PrimaryPart, TweenInfo.new(.1), {CFrame = config.Camera.CFrame}):Play()
Arms.PrimaryPart.CFrame = Arms.PrimaryPart.CFrame:Lerp(config.Camera.CFrame * config.OffCF, .9)
end)
You’re changing a bunch of stuff as you go. the alpha is .9 now, and also that’s not how your initial code looks. If this isn’t working, there must be something else you changed outside of your code. It’s probably because of the renderstepped, but if not you should check the initial position of the model.
If your trying to offset the viewmodel relative to the camera you should multiply the 2 cframes together.
This is the initial code, i forgot to add the other code as it is not important:
config.RunService.PreRender:Connect(function(dt)
Arms.PrimaryPart.CFrame = Arms.PrimaryPart.CFrame:Lerp(config.Camera.CFrame * config.OffCF, .9)
end)
I haven’t been changing anything.
If anything it was modified after testing
No, there is no disruption or interference
Listen here sir, pre render fires EVERY frame. Which means you’re re lerping the position every frame. That’s LITERALLY instantly. If you applied that to the position of an object at 0, 0, 0, and lerped to a position at 100, 100, 100 using an alpha of .9, every frame, two frames in you would already be at 99, 99, 99. two. frames. in.
You should try using SetPrimaryPartCFrame
config.RunService.PreRender:Connect(function(dt)
local new_cframe = Arms.PrimaryPart.CFrame:Lerp(config.Camera.CFrame * config.OffCF, .1)
Arms:SetPrimaryPartCFrame(new_cframe)
end)
That’s not the case they are not lerping it relative to it’s self.
Yes, but this is very deprecated. I don’t recommend.
This doesnt change anything, and yes, it is deprecated
Still not getting why you don’t want to use tween service? There is an linear interpolation method that it provides:
local Time = 1
local goal = config.Camera.CFrame * config.OffCF
local tweenInfo = TweenInfo.new(Time, Enum.EasingStyle.Linear)
local tween = TweenService:Create(Arms.PrimaryPart.CFrame, tweenInfo, goal)
I get that, but neither work.
If none of the listed solution’s are working your best bet would be to use breakpoints and watches on your values.
tween:Play() `````````````````````
I’m literally an Idiot, I was editing the wrong viewmodel, The Viewmodel was in ReplicatedStorage
while I was editing the one inside the workspace
, I anchored it and yep, that seemed to fix it.
Also, just because the the Code runs frequently, doesn’t mean that it wont work, everytime the frame runs, it sets the CFrame
90% of way to the Camera’s CFrame (because alpha works with numbers 0 - 1), RenderStepped
makes it contantly update.
That wont do anything, there is barley any code to use that
Literally:
local config = require(game.ReplicatedStorage.Mods.View_Config)
local Player = config.Player
local Arms = config.new()
config.RunService.PreRender:Connect(function()
Arms.PrimaryPart.CFrame = Arms.PrimaryPart.CFrame:Lerp(config.Camera.CFrame * config.OffCF, .9)
end)
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.