Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RT Camera may work incorrectly if two RT Screens are connected to it. #3115

Open
stepa2 opened this issue Aug 7, 2024 · 1 comment
Open
Labels

Comments

@stepa2
Copy link
Contributor

stepa2 commented Aug 7, 2024

It seems that, if RT Camera is connected to two monitors, of which only one is enabled,
one monitor can break another depending on the clientside :Think order.

I can't right now check if this issue actually exists and fix it, but it seems to exist, according to the code.
I've personally seen a bug when monitor breaks, but I'm not sure if it related to this issue.

function ENT:Think()
local camera = self:GetCamera()
if not self:GetActive() then
if IsValid(camera) then
camera:SetIsObserved(false)
end
self.ShouldRenderCamera = false
return
end
self.ShouldRenderCamera = self:IsScreenInRange(LocalPlayer())
if IsValid(camera) then
camera:SetIsObserved(self.ShouldRenderCamera)
end
end

To fix this, cameras clientside should store set of entities (for future compatibility, not necessary screens) that are observing it and :AddObserver(ent) and :RemoveObserver(ent) functions.

  • :AddObserver should call :SetIsObserved(true) (always, as after :AddObserver called, there will be >=1 observers).
  • :RemoveObserver should call :SetIsObserved(false), if it removed last observer.
@deltamolfar
Copy link
Contributor

Just checked - yeah, one monitor may disable another if in correct order

@thegrb93 thegrb93 added the Bug label Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants