Raised This Month: $ Target: $400
 0% 

Is ojbect visisble in screen (by angle).


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
MPNumB
Veteran Member
Join Date: Feb 2007
Location: Lithuania
Old 10-18-2010 , 03:44   Is ojbect visisble in screen (by angle).
Reply With Quote #1

I have a little problem. I have player position (pev_origin plus pev_view_ofs - lets name it Float:fEyePos[3]), player angle (am using pev_v_angle to be more accurate - Float:fAngle[3]), and I have a position in the world (Float:fPos[3]).

Now is there a really good way to check if Float:fPos[3] is visible on players screen with support of pev_fov (ignoring objects what can block visibility of that position)?

I tried:
PHP Code:
ExecuteHam(Ham_FVecVisibleiPlayerfPos); 
= crash.

I also tried:
PHP Code:
stock bool:fm_is_in_viewcone(index, const Float:point[3])
{
 new 
Float:angles[3];
 
pev(indexpev_anglesangles);
 
engfunc(EngFunc_MakeVectorsangles);
 
global_get(glb_v_forwardangles);
 
angles[2] = 0.0;
 
 new 
Float:origin[3], Float:diff[3], Float:norm[3];
 
pev(indexpev_originorigin);
 
xs_vec_sub(pointorigindiff);
 
diff[2] = 0.0;
 
 
xs_vec_normalize(diffnorm);
 new 
Float:dotFloat:fov;
 
dot xs_vec_dot(normangles);
 
 
pev(indexpev_fovfov);
 if (
dot >= floatcos(fov M_PI 360))
  return 
true;
 
 return 
false;

editing pev_angles to pev_v_angle, and adding pev_view_ofs to players origin - result not accurate by some degrees and when being close enough - not working at all.

---

Now I wonder, can anyone help me by giving the right and working calculation for this?
__________________
Skill and no annoying bugs with fixed balance issues is my goal!
My approved plugins what don't show up in Approved List:
* Bomb/Death/CSS Radar
* HotVision
___
Need help? Please check this documentation first.
MPNumB is offline
Send a message via Skype™ to MPNumB
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:17.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode