Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I get the player's camera to not go through transparency 1 bricks?

Asked by 5 years ago
Edited 5 years ago

I have a problem were I have a invisible door that goes into a room with a click-to-give uniform. The camera can go through the door, even with the group-only door script. I want the door to remain transparency 1 but make it so the camera can't go through it, any ideas? Door script I use is below on a transparency 1 part.

local rank = 47 -- The rank the player will need to get through (out of 255)
local groupID = 4957909 -- The group ID the player must be in

script.Parent.Touched:connect(function(hit)
if (hit and hit.Parent and game.Players:FindFirstChild(hit.Parent.Name)) then
    if (game.Players[hit.Parent.Name]:IsInGroup(groupID) and        game.Players[hit.Parent.Name]:GetRankInGroup(groupID) >= rank) then
            script.Parent.CanCollide = false
            script.Parent.Transparency = 1
            wait(1)
            script.Parent.CanCollide = true
            script.Parent.Transparency = 1
        else
            script.Parent.CanCollide = true
        end
    end
end)
0
Is CanCollide off for the door? Make sure it's toggled ON, on ALL parts associated with the door model. BryanFehr 133 — 5y
0
@BryanFehr CanColide is set to true and you can still leak the camera through the door. charrybomb -3 — 5y
0
If the door is set higher than 0.2 transparency, the camera can go through the door. Anything less than 0.2 transparency will make it so that the camera cannot go through it. I want the brick to have 1 transparency at all times without the camera going through it. charrybomb -3 — 5y
0
So if your gonna do this, make sure you duplicated the part, insert a normal mesh in it and set it's scale all to 0, and you're done. Use it on your main part as its easier. notfenv 171 — 5y

2 answers

Log in to vote
0
Answered by
notfenv 171
5 years ago

So if your gonna do this, make sure you duplicated the part, insert a normal mesh in it and set it's scale all to 0, and you're done. Use it on your main part as its easier.

Ad
Log in to vote
0
Answered by 5 years ago

If you override the Popper script's canOcclude function, you can tell it to occlude (have the camera not pass through) whatever you want. For instance, you could remove the part where it checks if the part's transparency is less than .25 or .95

See https://developer.roblox.com/articles/Movement-and-camera-controls for the basic idea of overriding scripts.

The Popper script is in PlayerScripts.PlayerModule.CameraModule.ZoomController.Popper

  • Go into play solo
  • Copy the PlayerModule script (in StarterPlayer.StarterPlayerScripts)
  • End play solo
  • Paste the PlayerModule script (with all its descendants) back into the StarterPlayerScripts folder
  • Make the changes to the Popper script (remove part.Transparency < 0.25 and and part.Transparency < 0.95 and in the function that starts on line 124) OR have it check to see if it's the special door you're interested in, like:
local specialDoor = workspace.SpecialDoor
local function canOcclude(part)
    -- Occluders must be:
    -- 1. Opaque
    -- 2. Interactable
    -- 3. Not in the same assembly as the subject

    if part == specialDoor then return true end
    if FFlagUserPoppercamLooseOpacityThreshold then
        return
            part.Transparency < 0.25 and
            part.CanCollide and
            subjectRoot ~= (part:GetRootPart() or part) and
            not part:IsA('TrussPart')
    else
        return
            part.Transparency < 0.95 and
            part.CanCollide and
            subjectRoot ~= (part:GetRootPart() or part)
    end
end

(In the above script, that's the default canOcclude function, but I added the 2 lines that have 'specialDoor' in them.)

Answer this question