PopperCam for invisible parts

I want the “PopperCam” to activate when an invisible barrier comes between the player and camera. It only seems to do so for visible parts.

I’ve looked through the Camera scripts and I haven’t found anything that deals with transparency/collidable parts specifically in this way.

How can I add this functionality without scripting my own version of the PopperCam?

The PopperCam uses this API to determine how far forward to move each frame.
http://wiki.roblox.com/index.php?title=API:Class/Camera/GetLargestCutoffDistance

You can find this in the latest version of the PopperCam module at line 141.

It should be pretty simple to replace that with a raycast from the HumanoidRootPart to the position of the camera. If the ray hits anything, just set “largest” to the distance between the HumanoidRootPart and the hit position.

You will incurr some performance cost doing this as the Camera API is faster due to it being engine-level.

1 Like

Thanks!

GetLargestCutoffDistance uses a fixed criteria for what things do and don’t pop the camera. You can’t change that criteria without rewriting this feature from the ground up.

So, I just finished rewriting this feature from the ground up and we’re currently working on getting it shipped.
GetLargestCutoffDistance is going the way of the dinosaurs; all Poppercam logic is now in Lua.
The new criteria is this:

local function canOcclude(part)
	return
		part.Transparency < 0.25 and
		canCollide(part) and -- accounts for avatar's collision group
		not part:IsA('TrussPart')
end

There basically wasn’t a good reason to keep this logic in the engine.

3 Likes

Awesome, even better. :slight_smile: