function Create(self)
    --Speed at which this can actually activate.
    self.speedThreshold = 100;

    --Whether to delete next frame.
    self.deleteNextFrame = false;
    
    --Check backward.
    local moid = SceneMan:CastMORay(self.Pos, Vector(self.Vel.X, self.Vel.Y):RadRotate(math.pi) * TimerMan.DeltaTimeSecs * 20, 0, self.Team, 0, true, 1);
    if moid ~= 0 and moid ~= 255 then
        local hitPos = Vector();
        SceneMan:CastFindMORay(self.Pos, Vector(self.Vel.X, self.Vel.Y):RadRotate(math.pi) * TimerMan.DeltaTimeSecs * 20, moid, hitPos, 0, true, 1);
        self.deleteNextFrame = true;
        self.Vel = (SceneMan:ShortestDistance(self.Pos, hitPos, true) / TimerMan.DeltaTimeSecs) / 20;
                
        local target = MovableMan:GetMOFromID(moid);

        local destroy = CreateAEmitter("Techion.rte/Nanobot Destroy Effect");
        destroy.Sharpness = moid;
        destroy.Pos = hitPos + SceneMan:ShortestDistance(hitPos, target.Pos, true):SetMagnitude(3);
        destroy.Vel = target.Vel;
        MovableMan:AddParticle(destroy);
    end
end

function Update(self)
    if self.deleteNextFrame then
        self.ToDelete = true;
    else
        if self.Vel.Magnitude >= self.speedThreshold then
            --Collide with objects and deploy the destroy effect.
            local moid = SceneMan:CastMORay(self.Pos, self.Vel * TimerMan.DeltaTimeSecs * 20, 0, self.Team, 0, true, 1);
            
            if moid ~= 0 and moid ~= 255 then
                local hitPos = Vector();
                SceneMan:CastFindMORay(self.Pos, self.Vel * TimerMan.DeltaTimeSecs * 20, moid, hitPos, 0, true, 1);
                self.deleteNextFrame = true;
                self.Vel = (SceneMan:ShortestDistance(self.Pos, hitPos, true) / TimerMan.DeltaTimeSecs) / 20;
                
                local target = MovableMan:GetMOFromID(moid);

                local destroy = CreateAEmitter("Techion.rte/Nanobot Destroy Effect");
                destroy.Sharpness = moid;
                destroy.Pos = hitPos + SceneMan:ShortestDistance(hitPos, target.Pos, true):SetMagnitude(3);
                destroy.Vel = target.Vel;
                MovableMan:AddParticle(destroy);
            end
        end
    end
end