I am making a version 2 of my own camera that everything works with modules but when updating the delta nothing happens
local script
local CameraModule = require(plrFolder:WaitForChild("CameraModule"))
--// LOCAL SCRIPT VARIABLES
local player = game.Players.LocalPlayer
local Mouse = player:GetMouse()
local CModule = CameraModule.New(player)
runs.RenderStepped:Connect(function()
CModule:update()
end)
module script
--// UPDATE MOUSE POSITION
function Camera:updateDelta(Delta)
local Delta = Delta
self.X = self.X - Delta.X/workspace.CurrentCamera.ViewportSize.X
self.Y = self.Y - Delta.Y/workspace.CurrentCamera.ViewportSize.Y
self.Y = math.rad(math.clamp(math.deg(self.Y),-40, 45))
end
function Camera:update()
UserInputService.InputChanged:Connect(function(inputObj,processed)
if inputObj.UserInputType == Enum.UserInputType.MouseMovement or inputObj.UserInputType == Enum.UserInputType.Touch then
self:updateDelta(inputObj.Delta)
end
end)
end
I forgot to remove it, it was dividing, in the video I’m trying to drag the camera and it doesn’t move even by placing the mouse in the center, in the script where it says camera: update I’m calling the updatedelta function which is supposed to update the delta inputobject but it doesn’t work
local player = self.Player
local Character = player.Character or player.CharacterAdded:Wait()
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
local finalOffset = CFrame.new(Vector3.new(self.ActualOffset.Value.X * self.ShoulderPosition.Value, self.ActualOffset.Value.Y, self.ActualOffset.Value.Z))
local CameraCFrame = CFrame.new(HumanoidRootPart.CFrame.Position) *
CFrame.Angles(0,self.X,0) *
CFrame.Angles(self.Y,0,0) *
finalOffset
local FinalCFrame = workspace.CurrentCamera.CFrame:Lerp(CameraCFrame, self.LerpValue.Value)
workspace.CurrentCamera.CFrame = FinalCFrame