@name Bezier Fun
@persist [E1 E2 E3 E4]:entity
@model models/hunter/blocks/cube025x025x025.mdl
interval(100)
if(first())
{
    function vector bezier2(Src:vector,End:vector,CurvePoint1:vector,CurvePoint2:vector,Progress:number)
    {
        local M1 = mix(mix(End,CurvePoint2,Progress),mix(CurvePoint2,CurvePoint1,Progress),Progress)
        local M2 = mix(mix(CurvePoint2,CurvePoint1,Progress),mix(CurvePoint1,Src,Progress),Progress)
        return mix(M1,M2,Progress)
    }
    function vector bezier(Src:vector,End:vector,CurvePoint:vector,Progress:number)
    {
        return mix(mix(Src,CurvePoint,Progress),mix(CurvePoint,End,Progress),Progress)
    }
    #E1 = propSpawn("models/hunter/blocks/cube025x025x025.mdl",entity():toWorld(vec(0,0,30)),0)
    E1 = entity()
    E1:propFreeze(0)
    E2 = propSpawn("models/hunter/blocks/cube025x025x025.mdl",entity():toWorld(vec(0,0,50)),0)
    #E3 = propSpawn("models/hunter/blocks/cube025x025x025.mdl",entity():toWorld(vec(0,0,70)),0)
    #E4 = propSpawn("models/hunter/blocks/cube025x025x025.mdl",entity():toWorld(vec(0,0,90)),0)
    E1:setAlpha(0)
    E2:setAlpha(0)
    #E3:setAlpha(50)
    #E4:setAlpha(50)
    for(I=1,31)
    {
        holoCreate(I)
        holoModel(I,"hq_torus")
        holoColor(I,randvec(0,255))
    }
    holoAlpha(31,0)
}
for(I=1,31)
{
    holoPos(I,bezier(E1:pos(),E2:pos(),(E1:pos()+E2:pos())/2+vec(0,0,25),I/31))
    holoAng(I,(holoEntity(I+1):pos()-holoEntity(I):pos()):toAngle()+ang(90,0,0))
}
E1:applyForce((E2:pos()-E1:pos())-E1:vel()*0.1*E1:mass())
E2:applyForce((E1:pos()-E2:pos())-E2:vel()*0.1*E2:mass())
