2

# Getting parts in view on a player's screen?

Axstin 55
7 years ago

How would I go about getting all the parts that is within view of a players screen?

Thanks.

0
Anyone? Axstin 55 — 7y
0
Easier said than done. I'm interested to know if anyone has a solution to this using Region3 (even with some inaccuracy because of the lack of rotated Region3s). Currently, the only method I can think of is gathering all the BasePart descendants of Workspace, and then checking individually against a function that transforms the 3D coordinates to 2D counter-parts. I have a function to do that if yo MrNicNac 855 — 7y
0
Yea, I was thinking about using Region3, but then I remembered you can't rotate Region3 areas. Also, did you mean to answer or post a comment? Your post was cut off :P Axstin 55 — 7y

2
6 years ago

Sorry for a year(!)'s delay, but ROBLOX just released a Camera update:

local pos, vis = workspace.CurrentCamera:WorldToScreenPoint(workspace.Part.Position)

if vis then
print("Point is Visible on screen!")
end


You can use this to loop through every part you care about to see if it's Visible. On it's own, this isn't perfect, but it's a good start.