Advertisement
Guest User

Untitled

a guest
Jun 27th, 2012
401
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.79 KB | None | 0 0
  1. @name multi mass center
  2. @inputs SizeA
  3. @outputs
  4. @persist A:array H:array [F R U TV V]:vector Size
  5. @trigger
  6. interval(100)
  7.  
  8. F=entity():forward()
  9. R=entity():right()
  10. U=entity():up()
  11. if(->SizeA){Size=Size}
  12. if(changed(Size) & ->SizeA){first()}
  13. if(first()){
  14.     Size=128
  15.     holoCreate(1)
  16.     holoScale(1,vec(0.5,0.5,0.5))
  17.     holoColor(1,vec(255,0,0))
  18.     holoModel(1,"hqsphere")
  19.     H:setVector(2,(entity():pos()+(F*Size)+(R*Size)-(U)))
  20.     H:setVector(3,(entity():pos()-(F*Size)+(R*Size)-(U)))
  21.     H:setVector(4,(entity():pos()+(F*Size)-(R*Size)-(U)))
  22.     H:setVector(5,(entity():pos()-(F*Size)-(R*Size)-(U)))
  23.     H:setVector(6,(entity():pos()+(F*Size)+(R*Size)+(U*Size)))
  24.     H:setVector(7,(entity():pos()-(F*Size)+(R*Size)+(U*Size)))
  25.     H:setVector(8,(entity():pos()+(F*Size)-(R*Size)+(U*Size)))
  26.     H:setVector(9,(entity():pos()-(F*Size)-(R*Size)+(U*Size)))
  27.    
  28.     for(I=2,9){
  29.     holoCreate(I)
  30.     holoPos(I,H:vector(I))
  31.     holoParent(I,entity())
  32.     holoColor(I,vec(255,0,0))  
  33.     }
  34.    
  35.     holoCreate(10)
  36.     holoScale(10,vec(1.5,1.5,2.5))
  37.     holoColor(10,vec(155,0,0))
  38.     holoModel(10,"hqcone")
  39.     holoAng(10,ang(180,0,0))
  40.     holoCreate(11)
  41.     holoColor(11,vec(55,0,0))
  42.     holoModel(11,"hqcylinder")
  43.     holoAng(11,ang(180,0,0))
  44. }
  45.  
  46. function loller(A:array){
  47. TV=A:entity(1):massCenter()
  48. for(I=2,A:count()){
  49.     V = A:entity(I):massCenter()
  50.     TV=TV+V
  51.    
  52. }
  53. TV=TV/A:count()-1
  54. #print(A:count()+ " found")
  55. holoPos(1,TV)
  56. holoPos(10,TV+U*Size/2)
  57. holoPos(11,TV+U*Size/4)
  58. holoScale(11,vec(0.1,0.1,(U:z()+Size/24)))
  59. #print(TV)
  60. TV=vec()  
  61. }
  62. if(findCanQuery()){
  63.     findInBox((entity():pos()+(F*Size)+(R*Size)-(U)),(entity():pos()-(F*Size)-(R*Size)+(U*Size)))
  64.     findIncludeClass("prop_*")
  65.     findIncludeClass("acf_*")
  66.  
  67.     A=findToArray()
  68.     loller(A)
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement