Advertisement
ZEROMemories

RotationToDirection

Mar 11th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. float radiansZ = rot->z * 0.0174532924f;
  2. float radiansX = rot->x * 0.0174532924f;
  3. float num = ABSF((float)cos((double)radiansX));
  4. Vector3 dir;
  5. dir.x = (float)((double)((float)(-(float)sin((double)radiansZ))) * (double)num);
  6. dir.y = (float)((double)((float)cos((double)radiansZ)) * (double)num);
  7. dir.z = (float)sin((double)radiansX);
  8. return dir;
  9.  
  10.  
  11.  
  12. if (TEST2)
  13. {
  14. Vector3 rot = Func::get_gameplay_cam_rot(2);
  15. Vector3 Velocity = Func::RotationToDirection(&rot);
  16.  
  17. int analogX = Buttons::AnalogMonitoring(Buttons::LeftX);
  18. int analogY = Buttons::AnalogMonitoring(Buttons::LeftY);
  19.  
  20. if (analogY == 0 || analogY == 254)
  21. {
  22. if (analogY == 0)
  23. {
  24. Func::SET_ENTITY_VELOCITY(player_ped_id, 10 * Velocity.x, 10 * Velocity.y, 10 * Velocity.z);
  25. }
  26. }
  27. /*if (analogX == 0 || analogX == 254)
  28. {
  29. if (analogX == 0) Velocity.x -= 10.0f;
  30. if (analogX == 254) Velocity.x += 10.0f;
  31. }
  32. if (Buttons::isDown(Buttons::Button_A))
  33. {
  34. Velocity.x *= 2.5f;
  35. Velocity.y *= 2.5f;
  36. }*/
  37. Func::SET_ENTITY_VELOCITY(player_ped_id, Velocity.x, Velocity.y, Velocity.z);
  38. Func::SET_ENTITY_ROTATION(player_ped_id, &Func::get_gameplay_cam_rot(2), 2, 1);
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement