I would suggest using a mathematical formula based on angle and possibly
distance. For example, if you take an accuracy cone that is x units
long, with angle y (from the center of the player's vision to the
outside of the cone), the radius of the base of the cone is x * tan(y).
(Simple trigonometry tells us this.)

So, assuming that you just want a crosshair, i.e., fixed in depth, you
just set x at something natural looking, and draw a circle or whatever
of radius x * tan(y), where y is simply the accuracy cone of the weapon.


If you want a circle that will enlarge as the terminus of the aim vector
grows more distant (i.e., it projects the cone onto the wall you're
looking at, telling you the exact maximum radius of a burst onto that
wall), then all you need do is send out a traceline down the aim vector,
use the traceline length for x, use the accuracy angle for y, and again
you have a radius quickly, without screen pixel to angle transforms.

Persuter

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:hlcoders-
> [EMAIL PROTECTED]] On Behalf Of Commando
> Sent: Sunday, April 14, 2002 5:33 PM
> To: [EMAIL PROTECTED]
> Subject: [hlcoders] Converting angles to screen pixels
>
> Okay, here's a tough one and I don't really know how to approach it.
I
> want to take an angle (a weapon's accuracy cone actually) and convert
it
> to
> the number of pixels on screen from a player's viewpoint that angle
would
> cover.  I know I will need to take the current FOV and the current
screen
> resolution into account, but I don't really know how to tackle this
> one.  If anyone has done this before, or even if someone can provide
parts
> of the transformation, I would really appreciate the help.
>
> Just in case I am not clear in what I am trying to do above, I will
> explain
> it here.  I want to take a weapons accuracy in degrees (which changes
> constantly in our mod) and draw sprites on the screen for the
crosshair
> that will give the player a good idea of how accurate their weapon is
at
> that time.  I may do it as an expanding circle that represents the
weapons
> current cone of accuracy.
>
> Robert Prouse
> http://www.tourofdutymod.com
>
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list archives,
> please visit:
> http://list.valvesoftware.com/mailman/listinfo/hlcoders


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to