Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void CPlayer::RaycastView()
- {
- int hit = 0;
- Vec3 origin = m_pView->GetViewWorldPosition();
- Vec3 dir = m_pView->GetViewWorldDirection();
- ray_hit rayHit;
- const int physSkipNum = 1;
- IPhysicalEntity* physSkip[physSkipNum];
- physSkip[0] = GetEntity()->GetPhysics();
- unsigned int flags = rwi_stop_at_pierceable | rwi_colltype_any | rwi_ignore_back_faces;
- float RayMaxDistance = 100.0f;
- hit = gEnv->pPhysicalWorld->RayWorldIntersection(origin, dir*RayMaxDistance, entity_query_flags::ent_all, flags, &rayHit, 1, physSkip, physSkipNum);
- if (hit)
- {
- IPersistantDebug* debug = gEnv->pGame->GetIGameFramework()->GetIPersistantDebug();
- debug->Begin("TestAddDirection", false);
- Vec3 lineStart = origin;
- Vec3 lineEnd = rayHit.pt;
- float timeOut = 4.0f;
- debug->AddLine(lineStart, lineEnd, ColorF(1.0f, 0.0f, 0.0f), timeOut);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement