Thread: Weapon Accuracy
View Single Post
Re: Weapon Accuracy
Old
  (#7)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: Weapon Accuracy - 18-03-2004

MAKE_VECTORS() builds an orthonormal referential of vectors out of a view angle and store each of the 3 vectors coordinates in the gpGlobals structure. If you don't call MAKE_VECTORS() before using gpGlobals->v_forward, gpGlobals->v_up or gpGlobals->v_right, you will use the vectors from the last referential that was declared using MAKE_VECTORS() - which may have been frames ago, for a totally different bot using a totally different view angle.

If your code works for months, that's because you're a lucky man: the player who is firing your TraceLine executed a MAKE_VECTORS() call in the engine with his view angle just before. But what if he doesn't ? What if your player calls MAKE_VECTORS() every 4 or 5 frames or so ? You never know what happens in the game DLL

Keep this in mind as this is systematic: before using any vector from the gpGlobals referential, ensure the referential is BUILT for the view angles you want to use it with. Calling MAKE_VECTORS() is not very much CPU intensive. I do it systematically. If you don't, you're never sure you're safe.



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
  
Reply With Quote