Im porting some code from JS to Lua and the logic heavy relies in checking if object are in camera frustum. What could be an Roblox alternative? Thank you!
You can use Camera:WorldToScreenPoint()'s second returned value which is whether the point is visible, though this will only show whether the object’s center is visible. A workaround would be to get the 8 corners of the model’s bounding box.
1 Like
Note this function does not perform any raycasting, meaning the visible bool will be true regardless if the *worldPoint* is obscured by
BaseParts or
Terrain .
But yeah I did not mention the obscured thing, so thanks for the tip!
In that case you could just cast a few rays to check whther it is obscured.