You could use this simple script:
Code:
function Create(self)
self.unpinned = 1
self.vector = Vector(0,0)
self.LTimer = Timer()
self.time1 = Timer()
self.time2 = Timer()
for actor in MovableMan.Actors do
if (actor.Pos - self.Pos).Magnitude < 60 then self.parent = actor;end
end
self.GlobalAccScalar = 0
end
function Update(self)
if self.LTimer:IsPastSimMS(50) then
if self.unpinned == 1 then
self.atarget = (SceneMan:CastMORay(Vector(self.Pos.X - self.Vel.X,self.Pos.Y - self.Vel.Y),Vector(self.Vel.X,self.Vel.Y),0,0,true,5))
self.target = MovableMan:GetMOFromID(self.atarget)
if self.target ~= nil then
self.target = MovableMan:GetMOFromID(self.target.RootID)
self.unpinned = 0
self.offset = Vector(self.Pos.X - self.target.Pos.X , self.Pos.Y - self.target.Pos.Y)
self.offsetang = self.offset.AbsRadAngle - self.target.RotAngle
self.target:AddAbsImpulseForce(Vector((self.Vel.X - self.target.Vel.Y), (self.Vel.Y - self.target.Vel.Y)) , self.Pos)
self.target.Vel = Vector(self.target.Vel.X + self.Vel.X / self.target.Mass , self.target.Vel.Y + self.Vel.Y / self.target.Mass)
self.time2:Reset()
end
end
end
if MovableMan:ValidMO(self.target) and self.unpinned == 0 then
self.Pos = Vector(self.target.Pos.X + (self.offset.Magnitude * math.cos(self.target.RotAngle + self.offsetang)),self.target.Pos.Y - (self.offset.Magnitude * math.sin(self.target.RotAngle + self.offsetang)))
self.Vel = self.target.Vel
if not self.time2:IsPastSimMS(5000) then
self.target.Vel.Y = -5
elseif not self.time2:IsPastSimMS(5200)
self.target.Vel.Y = 50
end
else self.unpinned = 1;end
end