View unanswered posts | View active topics It is currently Thu Dec 26, 2024 6:32 pm



This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
 Particle check causing momentary freeze *fixed* 
Author Message
User avatar

Joined: Fri Feb 16, 2007 8:43 pm
Posts: 1695
Location: AH SHIT FUCK AUGH
Post Particle check causing momentary freeze *fixed*
Uhh, yeah. That probably didn't make sense. Anyways, i've made a script which acts like a gravitational singularity (pulls stuff in), but if i also make it affect particles, the game locks up for a second or two, after which the projectile never appears. If it was fired near terrain, some particles get launched with a scary speed. Here's the abridged script that causes it:
Code:
function Create(self)
   self.pullRadius = 100;
   self.maxPull = 100;
end

function Update(self)
   for target in MovableMan.Particles do
      if target:IsAtRest() == false then
         if target.PresetName ~= "SGYCAN Gravitation Weak" and target.PresetName ~= "SGYCAN Glow Effect" then
            local targetVector = SceneMan:ShortestDistance(self.Pos, target.Pos, true);
            if targetVector.Magnitude < self.pullRadius then
               local angle = math.atan2(-targetVector.Y, targetVector.X);
               target.Vel = target.Vel + Vector((-self.maxPull*(1/targetVector.Magnitude)),0):RadRotate(angle);
            end
         end
      end
   end
end

I'm thinking that it somehow also checks the terrain, but if it does that, why haven't i seen this phenomenon before? The reflective robot i made (second iteration) checks for particles too, and it doesn't cause any lockups whatsoever. Any idea of why this happens?

Edit: Setting it to check for PinStrength == 0 reduces the lockup time, but it still happens. Argh.

Edit 2: argh crud, i never expected it to include itself in the particle check. In other words, making sure that the particle in question isn't itself fixes the problem entirely. Sorry about wasting space. :U


Wed Dec 08, 2010 4:03 pm
Profile WWW

Joined: Sat Feb 03, 2007 7:11 pm
Posts: 1496
Post Re: Particle check causing momentary freeze *fixed*
And the wind blows...


Sun Dec 12, 2010 8:13 pm
Profile WWW
Display posts from previous:  Sort by  
This topic is locked, you cannot edit posts or make further replies.   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.084s | 13 Queries | GZIP : Off ]