-1 points - posted 3799 days ago by Juba_PornBorn - status: Active - 5 comments watch embed this
I've noticed it's is easy to create such a command based on triangule calculation and angules. sin and cos

So define the closest proximity point from the bullet beam to calculate it to player parameter.


getbulletproximity [parameter1] [userid]

parameter1 stands for needed distance to calculate a sort of made circular FOV and if 1 or more player are in that distance it calculates their closest distance to the beam(perpendicular line)


no recoil scripts helper
bullet whizz sounds
acuracy stats
so on...

freddukes posted on 2008-02-11 07:01:05
This can be done with Pythagoras therom:

distance = sqrt((x - x1)^2+(y-y1)^2+(z-z1)^2)

You can do this by running a nearcoord command, to get all players within a <x y z> distance of eventvar(x) eventvar(y) eventvar(z) on bulletimpact, then run the distance check for each player within the distance, then get the shortest distance of the all...


Juba_PornBorn posted on 2008-02-12 12:42:34
This isn't what I mean since a bullet can go near you and impact can be in a far point from where you are. So if you only determine the closest player from impact it isn't in any way accurate. The way is get distance from player, get angule diference between bullet beam and "player beam" and with that you get the nearest distance from bullet beam and player.

Juba_PornBorn posted on 2008-02-12 12:45:25
This image tells it all:


Juba_PornBorn posted on 2008-02-12 12:49:44
And this is the formula to get it...

Juba_PornBorn posted on 2008-02-12 13:06:50
In the page there's a simple draw and translate it to game would be(wich is very easy).
Adjacent Side = Distance from you and player
Angle q = diference Angle between where you are shooting and player location
with that you get:
I want to calculate = hypotenuse side (wich is the bullet beam ending at the nearest point from player) and you get opposite side (wich is what you want!)

The only minor detail is that it doesn't directly get's you the bullet nearest point but the size side so you use the hypotenuse side + your location= and you get the coordinate