@name PointerAndMove
@inputs
@outputs 
@persist
@trigger 
runOnTick(1)




Self = entity():isWeldedTo()
Self:setText("Im Following you >:D")
entity():setAlpha(0)
entity():propNotSolid(1)
findByClass("player")
Array = findToArray()
Pos = Self:pos()
Self:propNotSolid(1)
entity():isWeldedTo():propNotSolid(1)
N = 0
Array=Self:getConstraints()
Count = Array:count()
Self:setMass(9999)
while (N != Count)
{
    Ent = Array:entity(N)
    Ent:setMass(1)
    N++
}

Target = findClosest(Pos)
findExcludePlayer(owner())
Target_Pos = Target:pos() + vec(0,0,100)
Direct = Pos - Target_Pos
Vector = Target_Pos - Self:pos()

SelfP = Self:pos()
SelfZ = SelfP:z()
TargetZ = Target_Pos:z()

if (SelfZ <= (TargetZ + 50))
{
Vector2 = vec(0,0,100)
Self:applyForce(Vector2)
}

Angle = Direct:toAngle()

TarQ = quat(Angle)
CurQ = quat(Self)
Q = TarQ/CurQ
V = Self:toLocal(rotationVector(Q)+Self:pos())
Self:applyTorque((250*V - 12*Self:angVelVector())*Self:inertia())


if (Vector:length() >= 100){
Self:applyForce(Vector*Self:mass())}
Self:applyForce(-Self:vel()*Self:mass()/2)

entity():isWeldedTo():soundPlay(randint(1,999999999),0, "ambient/alarms/apc_alarm_loop1.wav")






