Advertisement
Guest User

Untitled

a guest
Jun 30th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.35 KB | None | 0 0
  1. /**
  2. * Bibliothèque de fonctions permettant la visualisation 3D d'objets
  3. *
  4. * Copyright (C) 2014 Team ~R3F~
  5. *
  6. * This program is free software under the terms of the GNU General Public License version 3.
  7. * You should have received a copy of the GNU General Public License
  8. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  9. */
  10.  
  11. /*
  12. File: fn_vehicleShopInit3DPreview.sqf
  13. Modified By: NiiRoZz
  14.  
  15. Description:
  16. Called when a player open the vehicle shop and setup cam and the while for rotate around the vehicle
  17. */
  18. // Creating a camera.
  19. life_preview_3D_vehicle_cam = "camera" camCreate [2925.77,11415.8,966.563];
  20. life_preview_3D_vehicle_cam cameraEffect ["Internal", "BACK"];
  21. life_preview_3D_vehicle_cam camSetFocus [-1, -1];
  22. showCinemaBorder false;
  23. life_preview_3D_vehicle_cam camCommit 0;
  24.  
  25. life_preview_3D_vehicle_object = objNull;
  26.  
  27. // Thread execution performing a continuous rotation of the camera around the view object.
  28. 0 spawn
  29. {
  30. // Until we left the visualization.
  31. for "_i" from 0 to 1 step 0 do {
  32. if (isNull life_preview_3D_vehicle_cam) exitWith {};
  33. private ["_object","_distanceCam","_azimuthCam"];
  34.  
  35. // Waiting for a view object.
  36. waitUntil {!isNull life_preview_3D_vehicle_object};
  37.  
  38. _object = life_preview_3D_vehicle_object;
  39.  
  40. _distanceCam = 2.25 * (
  41. [boundingBoxReal _object select 0 select 0, boundingBoxReal _object select 0 select 2]
  42. distance
  43. [boundingBoxReal _object select 1 select 0, boundingBoxReal _object select 1 select 2]
  44. );
  45. _azimuthCam = 0;
  46.  
  47. life_preview_3D_vehicle_cam camSetTarget _object;
  48. life_preview_3D_vehicle_cam camSetPos (_object modelToWorld [_distanceCam * sin _azimuthCam, _distanceCam * cos _azimuthCam, _distanceCam * 0.33]);
  49. life_preview_3D_vehicle_cam camCommit 0;
  50.  
  51. // Rotation around the object.
  52. for "_i" from 0 to 1 step 0 do {
  53. if (!(life_preview_3D_vehicle_object isEqualTo _object)) exitWith {};
  54. _azimuthCam = _azimuthCam + 1.00;
  55.  
  56. life_preview_3D_vehicle_cam camSetPos (_object modelToWorld [_distanceCam * sin _azimuthCam, _distanceCam * cos _azimuthCam, _distanceCam * 0.33]);
  57. life_preview_3D_vehicle_cam camCommit 0.05;
  58.  
  59. sleep 0.05;
  60. };
  61. };
  62. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement