Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @name multi mass center
- @inputs SizeA
- @outputs
- @persist A:array H:array [F R U TV V]:vector Size
- @trigger
- interval(100)
- F=entity():forward()
- R=entity():right()
- U=entity():up()
- if(->SizeA){Size=Size}
- if(changed(Size) & ->SizeA){first()}
- if(first()){
- Size=128
- holoCreate(1)
- holoScale(1,vec(0.5,0.5,0.5))
- holoColor(1,vec(255,0,0))
- holoModel(1,"hqsphere")
- H:setVector(2,(entity():pos()+(F*Size)+(R*Size)-(U)))
- H:setVector(3,(entity():pos()-(F*Size)+(R*Size)-(U)))
- H:setVector(4,(entity():pos()+(F*Size)-(R*Size)-(U)))
- H:setVector(5,(entity():pos()-(F*Size)-(R*Size)-(U)))
- H:setVector(6,(entity():pos()+(F*Size)+(R*Size)+(U*Size)))
- H:setVector(7,(entity():pos()-(F*Size)+(R*Size)+(U*Size)))
- H:setVector(8,(entity():pos()+(F*Size)-(R*Size)+(U*Size)))
- H:setVector(9,(entity():pos()-(F*Size)-(R*Size)+(U*Size)))
- for(I=2,9){
- holoCreate(I)
- holoPos(I,H:vector(I))
- holoParent(I,entity())
- holoColor(I,vec(255,0,0))
- }
- holoCreate(10)
- holoScale(10,vec(1.5,1.5,2.5))
- holoColor(10,vec(155,0,0))
- holoModel(10,"hqcone")
- holoAng(10,ang(180,0,0))
- holoCreate(11)
- holoColor(11,vec(55,0,0))
- holoModel(11,"hqcylinder")
- holoAng(11,ang(180,0,0))
- }
- function loller(A:array){
- TV=A:entity(1):massCenter()
- for(I=2,A:count()){
- V = A:entity(I):massCenter()
- TV=TV+V
- }
- TV=TV/A:count()-1
- #print(A:count()+ " found")
- holoPos(1,TV)
- holoPos(10,TV+U*Size/2)
- holoPos(11,TV+U*Size/4)
- holoScale(11,vec(0.1,0.1,(U:z()+Size/24)))
- #print(TV)
- TV=vec()
- }
- if(findCanQuery()){
- findInBox((entity():pos()+(F*Size)+(R*Size)-(U)),(entity():pos()-(F*Size)-(R*Size)+(U*Size)))
- findIncludeClass("prop_*")
- findIncludeClass("acf_*")
- A=findToArray()
- loller(A)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement