Match the camera Orientation XZaxis to character Primary Part

Hello ! So i looked to this Wall stick/Gravity Controller - Resources / Community Resources - Developer Forum | Roblox but the camera script is literally impossible to understand for me. I have no clue how i could match the camera orientation to the character primary part like in the tutorial. (the game of the tuto if you want tu understand what i mean, it’s like mario galaxy camera → Wall stick controller new camera - Roblox)

If someone has worked on this previously or know how i could do i would be happy thank you. :slight_smile:

I know that the main lines of code that manage this system (in the BaseCamera module script) are theses :

function BaseCamera:CalculateNewLookCFrameFromArg(suppliedLookVector: Vector3?, rotateInput: Vector2): CFrame
	local currLookVector: Vector3 = suppliedLookVector or self:GetCameraLookVector()
	local currPitchAngle = math.asin(currLookVector.Y)
	local yTheta = math.clamp(rotateInput.Y, -MAX_Y + currPitchAngle, -MIN_Y + currPitchAngle)
	local constrainedRotateInput = Vector2.new(rotateInput.X, yTheta)
	local startCFrame = CFrame.new(ZERO_VECTOR3, currLookVector)
	local newLookCFrame = CFrame.Angles(0, -constrainedRotateInput.X, 0) * startCFrame * CFrame.Angles(-constrainedRotateInput.Y,0,0)
	return newLookCFrame
end