I'm trying to make an orthographic projection for a map feature, but I don't want other players to show up on it. Here's the jist of the GUI element I'm working with:
[code]panel.Paint = function(self, w, h)
for _, ply in pairs(player.GetAll()) do
// if ply is valid and has a character loaded and shit
ply:SetRenderMode(RENDERMODE_TRANSALPHA);
ply:SetColor(Color(0, 0, 0, 0));
end
end
local posX, posY = self:LocalToScreen(0, 0);
cam.Start2D();
renderView.origin = LocalPlayer():GetPos() + Vector(0, 0, 2000);
renderView.x = posX;
renderView.y = posY;
render.RenderView(renderView);
cam.End2D();
for _, ply in pairs(player.GetAll()) do
// if ply is valid and has a character loaded and shit
ply:SetRenderMode(RENDERMODE_NORMAL);
ply:SetColor(Color(255, 255, 255, 255));
end
end
end[/code]
I've tried putting those loops setting player rendering everywhere in there, but can't get it to have any effect. If I leave out the second loop that sets the players' rendering back to normal, it works, but everyone obviously stays invisible. Are there any better methods to accomplishing this?
[QUOTE=LilSumac;48482835]I'm trying to make an orthographic projection for a map feature, but I don't want other players to show up on it. Here's the jist of the GUI element I'm working with:
[code]panel.Paint = function(self, w, h)
for _, ply in pairs(player.GetAll()) do
// if ply is valid and has a character loaded and shit
ply:SetRenderMode(RENDERMODE_TRANSALPHA);
ply:SetColor(Color(0, 0, 0, 0));
end
end
local posX, posY = self:LocalToScreen(0, 0);
cam.Start2D();
renderView.origin = LocalPlayer():GetPos() + Vector(0, 0, 2000);
renderView.x = posX;
renderView.y = posY;
render.RenderView(renderView);
cam.End2D();
for _, ply in pairs(player.GetAll()) do
// if ply is valid and has a character loaded and shit
ply:SetRenderMode(RENDERMODE_NORMAL);
ply:SetColor(Color(255, 255, 255, 255));
end
end
end[/code]
I've tried putting those loops setting player rendering everywhere in there, but can't get it to have any effect. If I leave out the second loop that sets the players' rendering back to normal, it works, but everyone obviously stays invisible. Are there any better methods to accomplishing this?[/QUOTE]
I tested some myself, and using ply:SetNoDraw(true/false) works for me
[QUOTE=Dannelor;48482981]I tested some myself, and using ply:SetNoDraw(true/false) works for me[/QUOTE]
Worked perfectly, thanks man.
Sorry, you need to Log In to post a reply to this thread.