How would I utilize robloxes popper cam?

Hello, I’m trying to integrate robloxes built in popper cam system to my custom camera script. I’ve been reading the robloxes player module for a while now and I am still struggling to understand how it achieves the popping on it’s camera smoothly.

So far I’ve got to where the code is located and what functions could be used to give the effect. What I suspect I can do is use the ZoomController for it by attaching it to my current camera script, I wanted to see if anyone else has managed to do it and can possibly save me a headache of spending another week trying to figure this out if it goes wrong.

If you’re wondering why won’t I just use the :GetLargestCutoffDistance() it is because I want my camera script to feel much more cleaner and ‘professional’ in a sense, plus I really like it and want to make sure it is in my game.

2 Likes

Hello There!
I was having the same problem, but I figured it out.

So I have the PopperCam module, and I have this custom camera code.

local function camUpdate()

	cam.CameraType = Enum.CameraType.Scriptable
	uis.MouseBehavior = Enum.MouseBehavior.LockCenter

	if char and hrp then
		local startCFrame = CFrame.new((hrp.CFrame.p + Vector3.new(0,2,0)))*CFrame.Angles(0, math.rad(xAngle), 0)*CFrame.Angles(math.rad(yAngle), 0, 0)
		local cameraCFrame = startCFrame + startCFrame:VectorToWorldSpace(Vector3.new(CameraController.shoulderOffset.Position.X,CameraController.shoulderOffset.Position.Y,CameraController.shoulderOffset.Position.Z))
		local cameraFocus = startCFrame + startCFrame:VectorToWorldSpace(Vector3.new(CameraController.shoulderOffset.Position.X,0,-5000000))

		cam.CFrame = CFrame.new(cameraCFrame.p, cameraFocus.p) 
			* CFrame.Angles(CameraController.TapMag.Position,0,0)

	end
end

and as you see, this does not take mesh popping into account, so I simply added

local Popper = require(Modules.PopperCam)

local function camUpdate()

	cam.CameraType = Enum.CameraType.Scriptable
	uis.MouseBehavior = Enum.MouseBehavior.LockCenter

	if char and hrp then
		local startCFrame = CFrame.new((hrp.CFrame.p + Vector3.new(0,2,0)))*CFrame.Angles(0, math.rad(xAngle), 0)*CFrame.Angles(math.rad(yAngle), 0, 0)
		local cameraCFrame = startCFrame + startCFrame:VectorToWorldSpace(Vector3.new(CameraController.shoulderOffset.Position.X,CameraController.shoulderOffset.Position.Y,CameraController.shoulderOffset.Position.Z))
		local cameraFocus = startCFrame + startCFrame:VectorToWorldSpace(Vector3.new(CameraController.shoulderOffset.Position.X,0,-5000000))

		cam.CFrame = CFrame.new(cameraCFrame.p, cameraFocus.p) 
			* CFrame.Angles(CameraController.TapMag.Position,0,0)
		
		Popper:Update()

	end
end

And now it first runs my custom camera code, and then adjusts the length from the camera origin using PopperCam’s update function. Note that this code runs on RenderStep.

Enjoy!

3 Likes

They may or may not have this issue in their mind after 2 years lol

lol idk I just came across this post and happened to have the same problem, so I solved it :smiley:

1 Like

Wow, never knew I was gonna get a response to this. I’ve written my own popper but it is very crude and doesn’t work as smoothly, thank you so much for this!

Haha np! Sorry for replying 2 years late, I wouldn’t have been able to answer this in 2020 xD

2 Likes