hi all, making a camera system for a car, and the camera goes way too far back and doesnt return while moving. I need the car to stay center on the screen while still keeping the sway that it has. I’m going for something close to how racing games do their cameras.
heres my code so far:
local LookXPosition = LookXSpring.Position
local CurrentGForce = GetGForces()
VectorSpring.Target = Vector3.new(CurrentGForce)
local CameraVector = VectorSpring.Position
local CameraCFrame = cameraObj.CFrame:ToWorldSpace(CFrame.new(CameraVector) * CFrame.Angles(0, math.rad(-LookXPosition), 0))
local IdealRotation = CFrame.Angles(math.rad(LookYSpring.Position), 0, 0)
CameraCFrame = CameraCFrame:Lerp(CameraCFrame*CFrame.new(7.5*math.sign(CurrentGForce.X),0,0), CurrentGForce.X / (5*math.sign(CurrentGForce.X)))
CurrentCameraSpring.Target = Vector3.new(CameraCFrame.X, CameraCFrame.Y, CameraCFrame.Z)
camera.CFrame = (CFrame.new(CurrentCameraSpring.Position) * CameraCFrame.Rotation) * IdealRotation * cS(dt)
camera.FieldOfView = 70 + (DriveSeat.Velocity.Magnitude * 0.03)
LastChange = DriveSeat.CFrame:VectorToObjectSpace(DriveSeat.AssemblyLinearVelocity)
and heres how it looks:
https://gyazo.com/80868b33f1d9980f779034f1c860b1de