Update inputObject Delta with module doesn't work

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

What purpose does this line serve?

What is the issue you are describing in the video? How are you updating the camera CFrame?

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

Yes but how are you changing the coordinate frame?

this goes inside camera:update

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

I already fixed the delta, thanks anyway for trying to help me :slight_smile:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.