I am confused as to why my spring is ‘teleporting’ or ‘jerking’ to a spot then springs to my designated position.
If you didn’t understand what I said above here’s a video of the problem;
Here’s my code;
local Ego_Moose_Spring = require(game.ReplicatedStorage.Configs.EgoMooseSpring)
local angularFrequency = 0.1
local dampingRatio = 1
local spring = Ego_Moose_Spring.new(workspace.CurrentCamera.CFrame.Position, Vector3.new(), workspace.PinkHat.CFrame.Position)
player.CameraMode = Enum.CameraMode.LockFirstPerson
wait(0.5)
runService.RenderStepped:Connect(function(deltaTime)
spring.target = workspace.PinkHat.CFrame.Position
workspace.CurrentCamera.CFrame = CFrame.lookAt(workspace.CurrentCamera.CFrame.Position, spring.p)
spring:Update(deltaTime)
end)
Why does it jump to a random spot then spring to my target?
I think I have found the issue when I have the player go into first-person mode for some reason it bugs out the target workspace.CurrentCamera.CFrame.Position. The ‘jumping’ is caused because if I use player.CameraMode = Enum.CameraMode.LockFirstPerson it still thinks the camera position is where it was last at not the now zoomed-in camera.
The only reason is for if some reason the hat is somehow moved while the transition takes place the spring will keep up with the hat and still look at it.