Make Camera Move/Rotate relative to object/player

I want to create a camera mode in which the camera moves and rotates relative to its CameraSubject, which can be any BasePart (or Humanoid, but not that important). I have found these previous topics, which explain my problem way better, but they’re either a hacky solution or are outdated:

  1. Make classic camera move & rotate relative to object
  2. How to have the camera rotate with the player's relative rotation?
  3. How to keep camera's relative orientation?

The first post above has a nice solution (by Egomoose), but I want to find out if there is a way to avoid modifying the PlayerModule. It is always updated frequently, and I don’t want an update to mess up my game.

I’m thinking somewhere around getting the last LookVector and UpVector, like in the first topic, but I’m not sure how exactly to do that.

I would just experiment with different CameraType’s and set the CameraSubject to the relative BasePart. They should have an intended behavior there. If they don’t, you’d set it to Enum.CameraType.Scriptable and listen for when CameraSubject changes. Attach or Follow CameraType’s would be my personal first tries.

Yeah, I did try that but none really worked, thanks for the suggestion though.

Perhaps you can try storying the camera’s relative offset anytime the player isn’t making any input? Something like

local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
local UIS = game:GetService("UserInputService")
local TIS = game:GetService("TouchInputService")

local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local rootPart = character:WaitForChild("HumanoidRootPart")
local camera = workspace.CurrentCamera




local inputCount = 0
UIS.InputBegan:Connect(function(inputObject)
	inputCount += 1
	local endListener 
	
	endListener = UIS.InputEnded:Connect(function(otherInputObject)
		if inputObject.KeyCode == otherInputObject.KeyCode then
			inputCount -=1	
			endListener:Disconnect()
		end
	end)
	
end)

local lastSavedOffset = rootPart.CFrame:ToObjectSpace(camera.CFrame)


RunService.PreRender:Connect(function()
	if inputCount ~= 0 then	
		lastSavedOffset = rootPart.CFrame:ToObjectSpace(camera.CFrame)
		return
	end
	camera.CFrame = rootPart.CFrame:ToWorldSpace(lastSavedOffset)
end)

I haven’t really tested so there may be glaring issues. Hope you figure it out!

I don’t think the playermodule updates that frequently. A lot of games use it to toggle player controls off/on