Advertisement
djhonga2001

GTA V Raycast

Sep 10th, 2015
963
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. BOOL hit; Vector3 endCoords; Vector3 surfaceNormal; Entity entityHandle = 0;
  2. while(true)
  3. {
  4. Vector3 camCoords = CAM::GET_GAMEPLAY_CAM_COORD();
  5. Vector3 rot = CAM::GET_GAMEPLAY_CAM_ROT(2);
  6. Vector3 farCoords;
  7. farCoords.x = camCoords.x + rotToDir(rot).x * 5000;
  8. farCoords.y = camCoords.y + rotToDir(rot).y * 5000;
  9. farCoords.z = camCoords.z + rotToDir(rot).z * 5000;
  10.  
  11. int ray = WORLDPROBE::_CAST_RAY_POINT_TO_POINT(camCoords.x, camCoords.y, camCoords.z, farCoords.x, farCoords.y, farCoords.z, -1, 0, 7);
  12. WORLDPROBE::_GET_RAYCAST_RESULT(ray, &hit, &endCoords, &surfaceNormal, &entityHandle);
  13. if (hit && (ENTITY::DOES_ENTITY_EXIST(entityHandle)))
  14. {
  15. if (ENTITY::IS_ENTITY_A_VEHICLE(entityHandle))
  16. set_status_text("veh");
  17. else if (ENTITY::IS_ENTITY_A_PED(entityHandle))
  18. set_status_text("ped");
  19. else if (ENTITY::IS_ENTITY_AN_OBJECT(entityHandle))
  20. set_status_text("obj");
  21. }
  22. update_status_text();
  23. WAIT(0);
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement