This is what is happening with my camera(video)
I know it’s not the car because when using a fixed offset the camera smoothly follows.
I am using the implementation of the spring from the nevermore engine. I have tried setting the damper value to 1 (which I think is the critically damped option) but the same issue still occurs.
I am currently using this method of setting the desired camera CFrame. I have also tried separating the position and angle into separate components and updating each with a spring and another using CFrame.lookat using the cars lookvector and upvector but none of these produced a stable camera.
local function dc(cf: CFrame)
local px, py, pz,
xx, yx, zx,
xy, yy, zy,
xz, yz, zz = cf:GetComponents()
local p = Vector3.new(px, py, pz)
local rv = Vector3.new(xx, xy, xz)
local tv = Vector3.new(yx, yy, yz)
local bv = Vector3.new(zx, zy, zz)
return p, rv, tv, bv
end
local function CFrameFromTopBack(p, tv, bv)
local right = tv:Cross(bv)
return CFrame.new(p.x, p.y, p.z,
right.x, tv.x, bv.x,
right.y, tv.y, bv.y,
right.z, tv.z, bv.z):Orthonormalize()
end
-- init
springs = {
p = Spring.new(p),
tv = Spring.new(tv),
bv = Spring.new(bv)
},
-- connected to render step
local goalCF = target.CFrame * cameraSettings.CameraOffset
local p, _, tv, bv = dc(goalCF)
self.springs.p.t = p
self.springs.tv.t = tv
self.springs.bv.t = bv
for _, spring in pairs(self.springs) do
spring:TimeSkip(dt)
end
local finalCF = CFrameFromTopBack(self.springs.p.p, self.springs.tv.p, self.springs.bv.p)
camera.CFrame = finalCF
This is the sections of importance in the code
Hopefully someone knows what’s going on because I am stumped.