Re: Need help on magnetism effect.
Yeah, but you could condense it a bit, and optimize. (And change the actual variables to match up). And BTW, one (=) to set a value, two (==) to check.
Code:
self.magneticStrength = 0.5;
for particle in MovableMan.Particle do
if particle.PresetName == self.PresetName then
local dist = SceneMan:ShortestDistance(self.Pos,particle.Pos,true);
if dist.Magnitude < 5 then
particle.Vel = self.target.Vel + dist:SetMagnitude(self.magneticStrength^dist.Magnitude);
end
end
end
Dump the "self.magneticStrength = 0.5" in function Create(), don't leave it in Update().