@name Pos Stabilisation
@inputs Bt
@persist V:vector X Y Z Ang:angle
E = entity():isWeldedTo()

if(first() | duped()){
X = E:pos():x()
Y = E:pos():y()
Z = E:pos():z()
E:setColor(randint(0, 255), randint(0, 255), randint(0, 255))}

interval(1)


if(Bt == 1){
V=(vec(X,Y,Z) - E:pos())*25
E:applyForce(V + $V*5)

Ang = -E:angles()*10
E:applyAngForce(Ang + $Ang*5)
}
