function Create(self) --collision stuff self.victim = nil; self.rootVictim = nil; self.hasnthityet = true --parent finding wooo self.parent = MovableMan:GetMOFromID(MovableMan:GetRootMOID(SceneMan:CastMORay(self.Pos,(self.Vel * -50),255,0,true,3))); if self.parent == nil then self.box = Box(self.Pos - Vector(30,30),self.Pos + Vector(30,30)) --just in case raycasting doesnt work properly. for actor in MovableMan.Actors do if self.box:GetWithinBox(actor.Pos) then self.parent = MovableMan:GetMOFromID(actor.RootID) self:SetWhichMOToNotHit(self.parent, 2) end end end self.Massmultiplier = self.Mass * 5 end function Update(self) if self.victim == nil then self.targetID = SceneMan:CastMORay(self.Pos,((self.Vel / self.Vel.Magnitude)*20),self.parent.ID,0,0,false,5); if self.parent.RootID ~= MovableMan:GetRootMOID(self.targetID) and self.targetID ~= nil then if self.targetID ~= 255 and MovableMan:GetRootMOID(self.targetID) ~= self.parent.ID then self.dist = (MovableMan:GetMOFromID(MovableMan:GetRootMOID(self.targetID)).Pos - self.Pos).Magnitude; if self.dist < 40 then self.victim = MovableMan:GetMOFromID(MovableMan:GetRootMOID(self.targetID)); self.victim.Vel = Vector(((self.Vel.X * (2 / self.victim.Mass)) + self.victim.Vel.X) , ((self.Vel.Y * (2 / self.victim.Mass)) + self.victim.Vel.Y)) self.victim:AddImpulseForce(((self.Vel / 2) + (self.Vel * self.Massmultiplier)) / 2, (self.victim.Pos - self.Pos)) end end end end end