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

Add a way to use SetupPlayerVisibility hook #1973

Open
wrefgtzweve opened this issue Jan 12, 2025 · 4 comments
Open

Add a way to use SetupPlayerVisibility hook #1973

wrefgtzweve opened this issue Jan 12, 2025 · 4 comments
Labels

Comments

@wrefgtzweve
Copy link
Contributor

Currently SF cannot add to a players PVS, this is kind of a limitation as E2/Cam controllers can do it.
Having some way to use SetupPlayerVisibility and AddOriginToPVS for the owner of the chip could be nice.

https://gmodwiki.com/Global.AddOriginToPVS
Example from the wiki, note the possible crash if the hook is misused.

hook.Add( "SetupPlayerVisibility", "AddRTCamera", function( ply, viewEntity )
	-- Adds any view entity
	if viewEntity:IsValid() and !viewEntity:TestPVS( ply ) then -- If we don't test if the PVS is already loaded, it could crash the server.
		AddOriginToPVS( viewEntity:GetPos() )
	end
end )

It might be easier to just have functions instead of a hook as the hook logic isn't entirely needed for sfs usecase.
For example: EnablePVSOverride( ply, bool ) together with PVSOverride( ply, pos ) to avoid the before mentioned crash issue.
Would also be vastly simpler for players to use and less laggy as SetupPlayerVisibility does run a lot which could be an issue for sf.

@ax255
Copy link
Contributor

ax255 commented Jan 12, 2025

Can't you just use http://thegrb93.github.io/StarfallEx/#Types.Player.setViewEntity ?
Ive used it for freecam type of thing and it work well.

@legokidlogan
Copy link
Contributor

Yes, but then you need a serverside holo (or other always-transmitted entity) to attach it to. It's also still limited to only one PVS origin, it doesn't let you have multiple.

And what if you're using renderview instead of calcview, for a seamless portal? setViewEntity also changes the player's eye position and angles, so it would require you to also use calcview.

@ax255
Copy link
Contributor

ax255 commented Jan 12, 2025

Oh yes for seemless portal that would be very good

@MrSmig
Copy link

MrSmig commented Jan 12, 2025

Lots of cool rendering chips such as ones using renderview get restricted to relatively small areas because of the lack of PVS stuff, this would be incredible.

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

5 participants