• Render.drawsphere also draw from inside // When inside run command
    5 replies, posted
So I created a entity with the render.drawsphere how do I make it so it also draws it inside And my second question, how do I make it so it runs a command or it runs ENT:Use when you enter the sphere
1. I don't think there's a way to get drawsphere to draw on both sides, why do you want that to happen anyway? Is it meant to be a forcefield or something? 2. A sphere is a pretty simple thing mathematically since it's the same distance from the center on all sides, so I think all you need to check is the distance the player is from the entity's origin really - [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Vector/Distance]Vector:Distance[/url]
Just draw a second sphere with a negative size As for running things; [code] for k,v in pairs(ents.FindInSphere(spherepos,spheresize) do if v:IsPlayer() then --do crap end end [/code]
Use a negative value for the radius in render.DrawSphere.
Use this: [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/render/CullMode]render.CullMode[/url] and change the cullmode so this draw the inner faces
[QUOTE=Jason138;51282083]So I created a entity with the render.drawsphere how do I make it so it also draws it inside And my second question, how do I make it so it runs a command or it runs ENT:Use when you enter the sphere[/QUOTE] Naive way to do something when something touches something else, is to hook [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/Tick]GM:Tick[/url] on the server, and loop over every sphere, and loop over every player, and check if any players are inside any spheres. This is really bad, and slow. A better way to do it is to use the same hook, but on the client, to check if they are inside any spheres, and if they are, send a net message to the server. On the server, receive this message and double-check that the player really is inside the sphere. Note that you need to make the sphere "bigger" on the client, since when the client thinks they are inside the sphere and will send the message, is a little earlier then when the server thinks they are in the sphere.
Sorry, you need to Log In to post a reply to this thread.