Advertisement
Guest User

Untitled

a guest
Sep 8th, 2016
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.79 KB | None | 0 0
  1. void CPlayer::RaycastView()
  2. {
  3.     int hit = 0;
  4.     Vec3 origin = m_pView->GetViewWorldPosition();
  5.     Vec3 dir = m_pView->GetViewWorldDirection();
  6.     ray_hit rayHit;
  7.  
  8.     const int physSkipNum = 1;
  9.     IPhysicalEntity* physSkip[physSkipNum];
  10.     physSkip[0] = GetEntity()->GetPhysics();
  11.  
  12.     unsigned int flags = rwi_stop_at_pierceable | rwi_colltype_any | rwi_ignore_back_faces;
  13.    
  14.     hit = gEnv->pPhysicalWorld->RayWorldIntersection(origin, dir, entity_query_flags::ent_all, flags, &rayHit, 1, physSkip, 1);
  15.     if (hit)
  16.     {
  17.         IPersistantDebug* debug = gEnv->pGame->GetIGameFramework()->GetIPersistantDebug();
  18.         debug->Begin("TestAddDirection", false);
  19.  
  20.         Vec3 lineStart = origin;
  21.         Vec3 lineEnd = rayHit.pt;
  22.         float timeOut = 4.0f;
  23.  
  24.         debug->AddLine(lineStart, lineEnd, ColorF(1.0f, 0.0f, 0.0f), timeOut);
  25.     }
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement