• Draw a box outline in front of the player or good melee weapon design.
    4 replies, posted
I want to use ents.findInBox to find entities in a certain area in front of the player. The problem is I dont know what min and max I need. What I want to do is just get the players pos or shootpos and then pass the min and max off of that. To visualize it to make sure I have the values I want, I was hoping to create a 3d box on the screen representing the area that will be used for the ents:FindInBox. I tried using surface.drawline and then calculating the positions, but just couldn't get it working. The reason I'm doing this is because I want to make a melee weapon that isn't based purely on a players aim trace as every gmod one I've seen is. Those melee weapons are horrible since your crosshair has to be right over the enemy even though you are swiping. So I want to see if an entity is within the 'swipe box' then do a trace to the ents to make sure they aren't behind something and then give damage accordingly. This may be a bad way to do it but I dont know any other better way. So I guess if someone could help me out with either displaying a box outline so I can do this technique or provide me with a different way to make a good melee weapon, that'd be awesome.
So you are talking about range on a melee weapon as if, no matter the length of the sword if i'm swinging in from of myself, I will still hit you if you are in range of my weapon or in your case "swipe box"? Idea for this idea, you could reduce damage if its not a direct hit with the aim trace. Reduce the percent that you miss by from the crosshair.
You could do hull traces instead. They'll hit a larger area than just where the player's crosshair is. [b][url=http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexd642.html?title=Util.TraceHull]Util.TraceHull [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
Yes in a sense. The issue even with yours is how do I know if someone is hit with a melee weapon? An aim trace would only show that someone is hit if they are right in front of your cursor. I need to know if they are withing the swiping area of the melee weapon itself. Modifying the damage isn't major but it would be cool to do. [QUOTE=Nerdeboy;35109465]You could do hull traces instead. They'll hit a larger area than just where the player's crosshair is. [b][url=http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexd642.html?title=Util.TraceHull]Util.TraceHull [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b][/QUOTE] Awesome. That'd be perfect but I still need to find a good min and max.
I find that 50 units or so is pretty good for player reach.
Sorry, you need to Log In to post a reply to this thread.