david1337hax

Vector3 GTA Stuff

Jun 7th, 2018
341
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. Vector3 rot_to_direction(Vector3* rot)//scripthookdotnet source
  2. {
  3. float radiansZ = rot->z * 0.0174532924f;
  4. float radiansX = rot->x * 0.0174532924f;
  5. float num = std::abs((float)std::cos((double)radiansX));
  6. Vector3 dir;
  7. dir.x = (float)((double)((float)(-(float)std::sin((double)radiansZ))) * (double)num);
  8. dir.y = (float)((double)((float)std::cos((double)radiansZ)) * (double) num);
  9. dir.z = (float)std::sin((double)radiansX);
  10. return dir;
  11. }
  12.  
  13. Vector3 multiply(Vector3* vector, float x)
  14. {
  15. Vector3 result;
  16. result.x = vector->x;
  17. result.y = vector->y;
  18. result.z = vector->z;
  19.  
  20. result.x *= x;
  21. result.y *= x;
  22. result.z *= x;
  23.  
  24. return result;
  25. }
  26. Vector3 add(Vector3* vectorA, Vector3* vectorB)
  27. {
  28. Vector3 result;
  29. result.x = vectorA->x;
  30. result.y = vectorA->y;
  31. result.z = vectorA->z;
  32.  
  33. result.x += vectorB->x;
  34. result.y += vectorB->y;
  35. result.z += vectorB->z;
  36.  
  37. return result;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment