I do not know what you mean but for understanding I will show my code:
local rs = game:GetService("RunService")
local head : Part = script.Parent:WaitForChild("Head", 3)
local rootpart : Part = script.Parent:WaitForChild("HumanoidRootPart", 3)
local subject = script.Object
subject.Position = head.Position
workspace.CurrentCamera.CameraSubject = subject
local WEIGHT = 15
local camera = workspace.CurrentCamera
script.Parent.Humanoid.CameraOffset = Vector3.new(0,.5,0)
function updatesubject()
subject.Position = subject.Position:Lerp(head.Position + camera.CFrame.XVector * 2.5 + script.Parent.Humanoid.CameraOffset,1/WEIGHT)
end
rs:BindToRenderStep("UpdateSubject", Enum.RenderPriority.Last.Value + 1,updatesubject)
So what might be happening is the script that is updating the camera is doing so before the subject is moved. The script that does that is a Roblox script and can be edited. Iâll look and try to find where.
I tried and It is not working. I think character shaking because the part is too close to head and character moves slow, so part is faster than character and It keeps catch up character
local rs = game:GetService("RunService")
local head : Part = script.Parent:WaitForChild("Head", 3)
local rootpart : Part = script.Parent:WaitForChild("HumanoidRootPart", 3)
local subject = script.Object
subject.Position = head.Position
workspace.CurrentCamera.CameraSubject = subject
local WEIGHT = 15
local camera = workspace.CurrentCamera
script.Parent.Humanoid.CameraOffset = Vector3.new(0,.5,0)
function updatesubject()
subject.Position = subject.Position:Lerp(head.Position + camera.CFrame.XVector * 2.5 + script.Parent.Humanoid.CameraOffset,1/WEIGHT)
end
rs:BindToRenderStep("UpdateSubject", Enum.RenderPriority.Camera.Value + 1,updatesubject)
Your head is dynamic, meaning when you are walking, the characters torso which is also dynamic moves along physics, so does the head since itâs attached to your torso. And when you are lerping while walking, you are grabbing Head.Position which can have different Y position at that moment while you grabbed it, making your lerp inconsistent.
Your HumanoidRootPart is the only BasePart by default within your character that is static and does not rely on movement physics, using it would make your lerp point consistent.
local function updateSubject()
local rootPosition = root.CFrame.Position
local offset = --// pick your offset from rootPart and make a final position
end
Btw you can see it for yourself, jump into the game, select your character in the explorer, watch the bounding box move on Y axis, then check same with Head and RootPart, you will see what I mean
Not exactly, it should be just a vector3 representing how many studs is your subject away from rootpart, then create a final variable for your final position and sum your offsets and factors that you may have and just lerp
local function updateSubject()
local rootPosition = root.CFrame.Position
local offset = Vector3.new(2, 0, 0) --// 2 studs further from rootPosition on X axis
local finalPosition = subject.CFrame.Position:Lerp(rootPosition + offset, 0.5)
subject.Position = finalPosition
end
somewhat like that, i hate writing code on this platform
local rs = game:GetService("RunService")
local head : Part = script.Parent:WaitForChild("Head", 3)
local rootpart : Part = script.Parent:WaitForChild("HumanoidRootPart", 3)
local subject = script.Object
subject.Position = head.Position
workspace.CurrentCamera.CameraSubject = subject
local rootpart : Part = script.Parent:WaitForChild("HumanoidRootPart", 3)
local WEIGHT = 15
local camera = workspace.CurrentCamera
local offset = Vector3.new(0,2,0)
function updatesubject()
local finalPosition = subject.CFrame.Position:Lerp(rootpart.Position + camera.CFrame.XVector * 2.5 + offset, .3)
subject.Position = finalPosition
end
rs:BindToRenderStep("UpdateSubject", Enum.RenderPriority.Camera.Value + 1,updatesubject)