ENSL / NS

Natural Selection mod for Half-life
http://www.unknownworlds.com/ns
GNU General Public License v3.0
42 stars 12 forks source link

Gorge web hitbox too big #94

Closed pierow closed 1 year ago

pierow commented 3 years ago

When making a web strand, one large hitbox is created between the minimum and maximum of the X,Y,Z coordinates of the start and end points. As a result, diagonal webs create a hitbox much bigger than their visual representation. A player can place a web from the far bottom left to the close top right of a hallway and that web's hitbox will fill the entire hallway.

It seems to be created with this code: https://github.com/ENSL/NS/blob/d4e91fd005ba274701d962391d8ce5a2452ab8be/main/source/dlls/effects.cpp#L295-L310

I think the solution would be to create a smaller box with two constant edge sizes that closely fit the strand diameter, and scale the last size to the length of the strand. Then this box would then need have its origin and angles set to align with the start and end points of the strand. The angles can apparently be set with pev->angles but it's going to take some investigating to find the appropriate math or engine functions to determine what ones to use. The new code would probably be in a new RelinkBeam function of AvHWebStrand so it doesn't apply to other beams.

RGreenlees commented 1 year ago

I have created a PR to deal with this issue: https://github.com/ENSL/NS/pull/126

It replaces the axis-aligned hitboxes with traces and some extra calculations on cutting webs with the welder so that the hit detection more closely matches the visual representation of the webs.