Data Realms Fan Forums http://45.55.195.193/ |
|
Particle check causing momentary freeze *fixed* http://45.55.195.193/viewtopic.php?f=73&t=20473 |
Page 1 of 1 |
Author: | Shook [ Wed Dec 08, 2010 4:03 pm ] |
Post subject: | 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 |
Author: | zalo [ Sun Dec 12, 2010 8:13 pm ] |
Post subject: | Re: Particle check causing momentary freeze *fixed* |
And the wind blows... |
Page 1 of 1 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |