[QUOTE=G4MB!T;47588640]WELL good point. I'm not sure you can handle prop rendering if the entity is server side, but if worse comes to worse you could make your own entity system where you have the position, angle and model networked to the client and use ClientSideModel on the client where you can then control draw order.
Personally, and for practicality, cam.IgnoreZ would probably do what you want but it might have some undesirable side effects (i.e. Rendering through players and brushes).[/QUOTE]
Am i missing something?
All rendering is handled by the client, so of course you do it.
Just use a mix of
[LUA]
-- on creation
prop:SetNoDraw(true)
self.props[prop] = true
-- network the props to the client!
-- in a rendering context (ENT:Draw)?
for prop in pairs(self.props) do prop:DrawModel() end
-- render the text
[/LUA]
ENT.RenderGroup = RENDERGROUP_TRANSLUCENT in shared.
[QUOTE=rejax;47589304]Am i missing something?
All rendering is handled by the client, so of course you do it.
Just use a mix of
[LUA]
-- on creation
prop:SetNoDraw(true)
self.props[prop] = true
-- network the props to the client!
-- in a rendering context (ENT:Draw)?
for prop in pairs(self.props) do prop:DrawModel() end
-- render the text
[/LUA][/QUOTE]
I said that [b]you[/b] (Being the user) cannot handle rendering for things like prop_physics (i.e. Telling it when and how the render).
When you use SetNoDraw to true the draw function isnt even called. Aside from that, if you make your own entities and override the draw function then certainly but as for your pseudo code it would have to take place in something like PostDrawTranslucentRenderables.
How can i retrieve entities nearest VISIBLE point according to it's model?
entity:NearestPoint(vector) does not seem to retrieve nearest VISIBLE point.
Thanks alot
What is the vgui element for the menu that appears for example when Context Menu > right click something?
[QUOTE=Busan1;47589887]What is the vgui element for the menu that appears for example when Context Menu > right click something?[/QUOTE]
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Category:DMenu]DMenu[/url] ?
[QUOTE=Author.;47589913][img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Category:DMenu]DMenu[/url] ?[/QUOTE]
Thank you.
I have one more question:
I have a table that I insert into with table[ #table + 1 ], I want that there's max 100 items in the table at a time, I tried with:
[CODE]if( #table > 100 ) then
table[ table.GetLastKey( table ) - 99 ] = nil; // table name isn't actually table
end
[/CODE]
but it doesn't seem to work, not sure why, it seems logical.
[QUOTE=Busan1;47590071]Thank you.
I have one more question:
I have a table that I insert into with table[ #table + 1 ], I want that there's max 100 items in the table at a time, I tried with:
[CODE]if( #table > 100 ) then
table[ table.GetLastKey( table ) - 99 ] = nil; // table name isn't actually table
end
[/CODE]
but it doesn't seem to work, not sure why, it seems logical.[/QUOTE]
What do you want to happen once you reach the limit of the table? Do you want it to wrap around to the beginning? Overwrite the last element? Clear the table and start again?
[QUOTE=Busan1;47590071]Thank you.
I have one more question:
I have a table that I insert into with table[ #table + 1 ], I want that there's max 100 items in the table at a time, I tried with:
[CODE]if( #table > 100 ) then
table[ table.GetLastKey( table ) - 99 ] = nil; // table name isn't actually table
end
[/CODE]
but it doesn't seem to work, not sure why, it seems logical.[/QUOTE]
Something like this???
[lua]function insert ( table, value, max ) -- Have max as a argument, or a variable outside of the function.
if ( table.Count ( ) == max ) then
table.remove ( table, 1 )
table.insert ( table, value )
return
end
table.insert ( table, value )
end[/lua]
[QUOTE=G4MB!T;47589612]I said that [b]you[/b] (Being the user) cannot handle rendering for things like prop_physics (i.e. Telling it when and how the render).
When you use SetNoDraw to true the draw function isnt even called. Aside from that, if you make your own entities and override the draw function then certainly but as for your pseudo code it would have to take place in something like PostDrawTranslucentRenderables.[/QUOTE]
Oh okay my bad, misunderstood you!
Didn't know about SetNoDraw either.
[QUOTE=Author.;47590110]Something like this???
[lua]function insert ( table, value, max ) -- Have max as a argument, or a variable outside of the function.
if ( table.Count ( ) == max ) then
table.remove ( table, 1 )
table.insert ( table, value )
return
end
table.insert ( table, value )
end[/lua][/QUOTE]
Hmm I think that would function potentially although what I am after is keeping the latest added element in the last key.
[QUOTE=Busan1;47590150]Hmm I think that would function potentially although what I am after is keeping the latest added element in the last key.[/QUOTE]
That's what it does? It removes the first element in there, and keeps the newly added one.
[QUOTE=Busan1;47590150]Hmm I think that would function potentially although what I am after is keeping the latest added element in the last key.[/QUOTE]
If I'm understanding you right, that'll basically do that. It's a queue.
Also that code won't work because you overloaded the table library. Try this:
[lua]
function insertQueue( tab, value, max )
while #tab >= max do table.remove( tab, 1 ) end
tab[ #tab + 1 ] = value
end
[/lua]
Edit: Fixed while condition being off-by-one
[QUOTE=Lixquid;47590173]If I'm understanding you right, that'll basically do that. It's a queue.
Also that code won't work because you overloaded the table library. Try this:
[lua]
function insertQueue( tab, value, max )
while #tab > max do table.remove( tab, 1 ) end
tab[ #tab + 1 ] = value
end
[/lua][/QUOTE]
If you can only add one thing at a time, there's no point using a while statement.
[QUOTE=James xX;47590800]If you can only add one thing at a time, there's no point using a while statement.[/QUOTE]
Basically, better safe than sorry.
[QUOTE=Lixquid;47590886]Basically, better safe than sorry.[/QUOTE]
safe from what though, exactly.
[QUOTE=James xX;47591027]safe from what though, exactly.[/QUOTE]
anonymous hacker 4chan
From the table being inserted via other methods, I don't know how likely that is. It was my first instinct on a snippet which I wrote in 30 seconds. If it's such a big issue, here's the non-while version:
[lua]
function insertQueue( tab, value, max )
if #tab == max then table.remove( tab, 1 ) end
tab[ #tab + 1 ] = value
end
[/lua]
That kind of indecisive mixing and matching between regular tables and queues smells like shoddy programming, but I guess it's up to the author.
[QUOTE=James xX;47590800]If you can only add one thing at a time, there's no point using a while statement.[/QUOTE]
What if you have a new max value that is lower than the previous?
Any way to prevent sound.PlayURL() to not :lower() the string of the URL, it's bugging out youtube support.
Hey, what's the best way to draw all non-view/world entities in a scene in a specific color? I've got to here so far, but I'm lost after that.
[code]
cam.Start3D(EyePos(),EyeAngles(),nil,0,0,ScrW(),ScrH(),nil,nil)
render.SuppressEngineLighting( true )
for k,v in pairs(ents.GetAll()) do
local ent = v
if !ent:IsWorld() and !string.find(v:GetClass(),"view") and !string.find(v:GetClass(),"hand") then
ent:DrawModel()
end
end
render.SuppressEngineLighting( false )
cam.End3D()
[/code]
[QUOTE=LUModder;47594248]Any way to prevent sound.PlayURL() to not :lower() the string of the URL, it's bugging out youtube support.[/QUOTE]
It doesn't do that. The string you pass to sound.PlayURL() is not modified in any way and is passed to BASS directly.
[editline]25th April 2015[/editline]
[QUOTE=TFA;47594531]Hey, what's the best way to draw all non-view/world entities in a scene in a specific color? I've got to here so far, but I'm lost after that.
[code]
cam.Start3D(EyePos(),EyeAngles(),nil,0,0,ScrW(),ScrH(),nil,nil)
render.SuppressEngineLighting( true )
for k,v in pairs(ents.GetAll()) do
local ent = v
if !ent:IsWorld() and !string.find(v:GetClass(),"view") and !string.find(v:GetClass(),"hand") then
ent:DrawModel()
end
end
render.SuppressEngineLighting( false )
cam.End3D()
[/code][/QUOTE]
local oldCol = ent:GetColor()
ent:SetColor( newCol )
ent:DrawModel()
ent:SetColor( oldCol )
???
[QUOTE=Robotboy655;47594544]-stuff-[/QUOTE]
[code]
cam.Start3D(EyePos(),EyeAngles(),nil,0,0,ScrW(),ScrH(),nil,nil)
render.SuppressEngineLighting( true )
for k,v in pairs(ents.GetAll()) do
local ent = v
if !ent:IsWorld() and !string.find(v:GetClass(),"view") and !string.find(v:GetClass(),"hand") then
local oldCol = ent:GetColor()
ent:SetColor( Color(255,0,0,255) )
ent:DrawModel()
ent:SetColor( oldCol )
end
end
render.SuppressEngineLighting( false )
cam.End3D()
[/code]
Draws with default color. I tried creating the variable newCol first, and that didn't work, so that's why I'm creating a new Color each draw in the code I just posted.
[QUOTE=TFA;47594613][code]
cam.Start3D(EyePos(),EyeAngles(),nil,0,0,ScrW(),ScrH(),nil,nil)
render.SuppressEngineLighting( true )
for k,v in pairs(ents.GetAll()) do
local ent = v
if !ent:IsWorld() and !string.find(v:GetClass(),"view") and !string.find(v:GetClass(),"hand") then
local oldCol = ent:GetColor()
ent:SetColor( Color(255,0,0,255) )
ent:DrawModel()
ent:SetColor( oldCol )
end
end
render.SuppressEngineLighting( false )
cam.End3D()
[/code]
Draws with default color. I tried creating the variable newCol first, and that didn't work, so that's why I'm creating a new Color each draw in the code I just posted.[/QUOTE]
ProTip: You do not need all those arguments for cam.Start3D(), you can just call it as cam.Start3D().
As for your problem, are you even sure the models are being drawn at all? What hook are you using?
-Nevermind, found an alternate method for what I was trying to do-
[QUOTE=Lixquid;47590173]If I'm understanding you right, that'll basically do that. It's a queue.
Also that code won't work because you overloaded the table library. Try this:
[lua]
function insertQueue( tab, value, max )
while #tab >= max do table.remove( tab, 1 ) end
tab[ #tab + 1 ] = value
end
[/lua]
Edit: Fixed while condition being off-by-one[/QUOTE]
[QUOTE=Author.;47590110]Something like this???
[lua]function insert ( table, value, max ) -- Have max as a argument, or a variable outside of the function.
if ( table.Count ( ) == max ) then
table.remove ( table, 1 )
table.insert ( table, value )
return
end
table.insert ( table, value )
end[/lua][/QUOTE]
Thank you both, sorry for the late response I was unable to test it earlier.
It works great.
This question is aimed at someone with a hell of a lot of experience with gmod: How come the master server challenge query response looks nothing like what's on the valve documentation?
Does anyone know where I and learn about drawing curves? Google isn't being useful for me.
I'm trying to draw a curve from 2 points along with a angle from the first point.
[QUOTE=highvoltage;47597068]Does anyone know where I and learn about drawing curves? Google isn't being useful for me.
I'm trying to draw a curve from 2 points along with a angle from the first point.[/QUOTE]
My solution would be to calculate the mathematical function by integration the differential that fits the d/dx at points A and B (probably template it on a 2nd order polynomial), and in a loop, drawing the points along that line.
Ok, so i've been trying to solve this problem for a while, but i have tried everything and it still doesn't work.
Basically i can't control the speed of the animation for the landing gears. When i load the model in HLMV the animation works perfectly, but when using it in Gmod it ignores all the parameters and just moves superfast.
The animation has 200 frames, with a keyframe each 50 frames (0, 50, 100, 150, 200). That is to prevent the landing gear hatches to close before the wheels are fully retracted, which would happen if i only used 2 keyframes, at the beggining and at the end of the animation.
This is what happens (sorry for the size, i forgot to change the recording resolution when i made this clip):
[vid]http://a.pomf.se/ygtdih.mp4[/vid]
And this is the .qc i used to compile each model. I even tried using [URL="http://wiki.garrysmod.com/page/Entity/SetPlaybackRate"]SetPlaybackRate[/URL] but apparently that function is broken, could anyone confirm that?
[CODE]
$modelname "Killstr3aKs\Neuroplanes\German\Me_410_wing_l_anim.mdl"
$body "wing_l_ref" "wing_l_ref.smd"
$cdmaterials "models\Killstr3aKs\Neuroplanes\German\Me_410\"
$surfaceprop "metal"
$sequence idle "wing_l_anim_idle_up" fps 30 loop ACT_IDLE 1
$sequence idle_geardown "wing_l_anim_idle_down" fps 30 loop
$sequence gear_up "wing_l_anim_up" fps 30 snap
$sequence gear_down "wing_l_anim_down" fps 30 snap
$collisionmodel "wing_l_phy.smd" {
$mass 9000.0
$inertia 10.00
$damping 0.01
$rotdamping 1.50
}[/CODE]
And i know this isn't the best place to ask for modelling or animation stuff, but i have made multiple threads on the Modelling section and i still haven't solved this :/
Sorry, you need to Log In to post a reply to this thread.