Okay, I've been doing some research and I think I can piece together most of the equations. The only thing I need to know how the FOV is defined in the HL SDK. In OpenGL, the FOV can be set in a call to gluPerspective where the FOV passed in is the FOV in degrees in the y direction. In DirectX, you set a FOV by setting the front and back clipping frame then using Viewport::SetField and passing in a height that is half the height of the front clipping plane. You can get an angle from that with a bit of trig and the distance from the player of the front clipping plane.
I searched through the SDK and all I know so far is that FOV is in degrees, the default is 90. There is also a CalcFov on the client that takes a FOV in the x plane (if the naming is correct ;o) ) That function is only ever passed in the client's FOV, so I am assuming that in HL, the FOV is an angle in degrees in the x plane, but that is contrary to the way that OpenGL and DirectX do it, so I wanted to check. Anyone know the answer to this one? Thank Robert Prouse http://www.tourofdutymod.com At 06:32 PM 14/04/2002 -0400, you wrote: >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 > _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders