I’m creating a game from a bird’s eye view and I’m thinking about a player’s vision system that would only see one part of the screen and the rest would be covered with fog.
local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local hRP = character.HumanoidRootPart
local mouse = player:GetMouse()
game:GetService("RunService").RenderStepped:Connect(function()
character:SetPrimaryPartCFrame(CFrame.new(hRP.CFrame.Position, Vector3.new(mouse.Hit.Position.X, hRP.CFrame.Position.Y, mouse.Hit.Position.Z)))
end)
What is the issue?
I have no idea how to do this.
What solutions have you tried so far?
I looked for help on the developer center, but I didn’t find anything.
At the moment I am not worried about the fog, but more about how to make such a view that would cover the place where the fog is, for example, with a black screen and only the visible place would be in front of me
If you’re comfortable with math you could probably implement a grid system and then based on the FOV calculate the points inside of the FOV triangle and make those grids invisible
I can’t do it that way, because you will see the player even if it is very very dark, so I would like to make a special triangle like in the picture, to enter my own values of what should happen in them, etc.
As @InfiniteYield said, a solid GUI on screen Make it look liek a solid fog background with a clear triangle cut out and blurred edges between the solid and clear sections.
Put the GUI on screen and center it to the player’s Position. figure out where the player is pointing on screen and rotate the GUI.
The other option is if the camera is alway directly above the player then place a SurfaceGUI or decal on a Transparent Part with the same wedge shaped fog image. Position it in the workspace so it’s directly above the player, or even weld it to the player make it a small Part with a BlockMesh in it to make the fog extend off the screen so the edges are never visible.