I am creating a grass generation script that I’m currently trying to optimize for maximum performance. I’ve finally gotten :WorldToViewportPoint working and am looking for a way to slightly edit the players current camera when doing this action.
local NewCamera = workspace.CurrentCamera
local _, visible = NewCamera:WorldToViewportPoint(GrassFolder[i].Position)
if (visible) then
end
Is there a way I could go about Making CurrentCamera slightly zoomed back for the function. I don’t want this to affect what the player sees
I want to check a little further back of the current camera’s view so the grass that is slightly out of camera’s view still moves.
Apologies on how I worded my question, I can understand how it could be hard to read. I don’t know the exact terms I should use.
You can create an entirely new Camera instance that isn’t the CurrentCamera for any players, or you can move the camera, do the calculation and then move it back to the original position without yielding (waiting), which wouldn’t be visible.
I have already tried cloning the camera instant but when I do that it covers 2/3 of the screen. I did also tried touching the actual camera and adjusting it for the function and resetting it after but I don’t know exactly how to edit the camera’s view. I’ve tried simple stuff like CurrentCamera.CFrame *= CFrame.new(2,2,2) but nothing seems to change. I know there is way more you can calculate and change with cframes but I don’t know exactly what I’d need to change for this.
To add onto this, I’ve added a custom Zooming script using max and min zoom distance, Still needs polishing but it was so I could attempt a simpler way at doing this. But I don’t think max and min zoom distance will cooperate with a for loop that changes it 300 times in a single frame.