Advertisement
Ahmad45123

Untitled

Nov 24th, 2015
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.12 KB | None | 0 0
  1. GenerarteSphere()
  2. {
  3.     //First get the current players pos to be the center of the spiral.
  4.     new Float:centerX, Float:centerY, Float:centerZ;
  5.     GetPlayerPos(playerid, centerX, centerY, centerZ);
  6.    
  7.     //Set the variables.. They are consts here but can be set as variables.
  8.     new Float:a = 2.0, Float:b = 2.0;
  9.     new size = 750;
  10.    
  11.     //Start looping.
  12.     new Float:oldX = centerX, Float:oldY = centerY, Float:oldZ = centerZ; //used to save the latest x, y and z for creating the lines.
  13.     for(new i; i < size; i++)
  14.     {
  15.         //Get the angle.
  16.         new Float:angle = 0.1 * i;
  17.        
  18.         //Calculate X and Y.
  19.         new Float:x = (centerX + (a + b * angle) * floatcos(angle));
  20.         new Float:y = (centerY + (a + b * angle) * floatcos(angle));
  21.        
  22.         //Now calculate Z. (We just need to keep going upwards.. So I guess this should work).
  23.         new Float:z = (centerZ + angle);
  24.        
  25.         //Now use the x, y and z to generate a line to those...
  26.         CreateLineOfObjects(oldX, oldY, oldZ, x, y, z);
  27.        
  28.         //Store the new x,y,z.
  29.         oldX = x; oldY = y; oldZ = ;
  30.     }
  31.     return 1;
  32. }
  33.  
  34.  
  35. stock CreateLineOfObjects(Float:ox, Float:ox, Float:oz, Float:nx, Float:ny, Float:nz)
  36. {
  37.     //....
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement