Hi, I’m new on GMod Lua scripting so please don’t take too hard with me.
I’d like to identity what sort of Entity the player is aiming to with its crosshair, to do so I decided to look into some TTT weapons source code and I figured out that most of them uses the util.TraceHull function to get the entity table/object and with this table it checks if it is a player, weapon, vehicle, etc., correct me if I said something wrong.
But I got confused about the until.TraceHull function parameters, according to its article in the wiki its unique parameter is a table with some specific keys, some of them I have some sort of ideia about what it does, but others I have no ideia even after reading its description. I will make a table with like the one in the wiki article and add what I think it does, please correct me on those I wrote something and explain me the others I have no idea about its purpose.
**Type … Name … Description **…What I think it is
Vector … start … The start position of the trace … I think that if I intend to get the Entity I’m looking at, it’d be the user/player position
Vector … mins … Hull mins … I have no idea about this one
Vector … maxs … Hull maxs … I have no idea about this one
number … mask … The trace mask MASK_ Enums … I have no idea about this one
Entity … filter … Things the trace should not hit. Can also be a table of entities. … I think it is the type of entities the trace should ignore, but could you give me an example?
Vector … endpos … The end position of the trace … I think that if I intend to get the Entity I’m looking at, it’d be the entity position, but if I don’t know where it’s how can I specify its position?
Sorry about the table format I tried to use the built-in tools to make the table, but when you submit the post it only shows HTML source code.
Thanks in advance.