by Cobalt » Sun Jul 12, 2015 9:29 pm
So lets say we are touching a player, this code seems to return perfectly the side touched , but if the player changes angles_y for example, since the hit box does not rotate with it, how could we recalculate the new side?
I had asked LH a similar question years ago and he said we need to use dotproduct, but it was to really see what side if the face we are closest to. I had the code working but forgot where I put it. We could use similar here to get started on this job, but of course there is the issue when the angle is a% toward one side and b% on the other.
Not sure if it makes things easier but in the mod I am putting this in, its using Frikbots and I believe Frik has a Phys_obj ent spawned around the outside of the hitbox with a movetype_fly to avoid the old "demonland" wav thud noise and maybe some other stuff Im not sure. Id have to look further, but it might match the players angles_y or it could be modded to match them. Looking at this concept, could this code merely spawn something similar as perhaps a trigger field which rotates with the players angles_y then we check for that ent specificly? Or do we get more mileage doing more involved calcs the other way?
Also wanted to bring up the previously mentioned issue about the Z calc for a headshot not working when the target is a percentage lower or higher then the attacker. I thought that could merely be cured with some basic trig, but it seems there is something missing. Also I noticed if you change the start of the Z for the traceline higher to a point representing the players actual eye level, you fix this, at least for the cases where the target is super close with the same Z origin.
As the target gets higher, you have to aim higher within what looks like a proportional area relative to the new z, but I am at a loss to get there completely - same goes for when the Z is lower for the targ vs the attacker.....