Flint Particle System Forum - Strange behavior likely with 2D Collide and/or BoundingBox actions 2016-05-08T00:34:48+01:00 http://flintparticles.org/forum/ Lussumo Vanilla & Feed Publisher Strange behavior likely with 2D Collide and/or BoundingBox actions http://flintparticles.org/forum/comments.php?DiscussionID=489&Focus=1647#Comment_1647 2011-05-24T22:20:59+01:00 2016-05-08T00:34:48+01:00 Colin http://flintparticles.org/forum/account.php?u=390 Hi Richard, I've been working recently on 2D simulations of liquids, which involve high particle densities. I noticed that in these simulations the particles spontaneously adopt a configuration ...
I've been working recently on 2D simulations of liquids, which involve high particle densities. I noticed that in these simulations the particles spontaneously adopt a configuration in which a gradient in particle density is present from left to right (more particles/area on left; fewer particles/area on right). You can see a very simple simulation that illustrates this here:

http://colinashe.net/flint

As is clear from this simulation's source (which I've included at the bottom of this message), only the Move, Collide, and BoundingBox actions are used. I have taken note of the caveat you included in the source for the Collide action, so I guess the question here is whether the behavior described and demonstrated above is really a bug or whether the system is behaving as designed. If the described behavior is consistent with your design, perhaps you could suggest some changes I could make to the Collide action that would mitigate the gradient-forming tendencies of the system as it stands.

Thanks,
Colin


=============Begin Source Code===============

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:f="http://flintparticles.org/2009/flint2d"
minWidth="500" minHeight="500"
backgroundColor="#000000"
frameRate="60" xmlns:debug="org.flintparticles.common.debug.*">

<fx:Script>
<![CDATA[
import org.flintparticles.common.displayObjects.Dot;
]]>
</fx:Script>


<f:DisplayObjectRenderer id="renderer" width="500" height="500">
<f:emitters>
<f:Emitter id="emitter" autoStart="true">
<f:counter>
<f:Blast startCount="800"/>
</f:counter>
<f:initializers>
<f:Position>
<f:RectangleZone top="10" left="10" bottom="490" right="490"/>
</f:Position>
<f:Velocity>
<f:DiscZone centerX="0" centerY="0" innerRadius="50" outerRadius="80"/>
</f:Velocity>
<f:InitializerGroup>
<f:ImageClass imageClass="{Dot}" parameters="8"/>
<f:CollisionRadiusInit radius="8"/>
<f:MassInit mass="1"/>
<f:ColorInit minColor="0xFFFFFFFF" maxColor="0xFFFFFFFF"/>
</f:InitializerGroup>
</f:initializers>
<f:actions>
<f:Move/>
<f:Collide/>
<f:BoundingBox left="0" right="500" top="0" bottom="500"/>
</f:actions>
</f:Emitter>
</f:emitters>
</f:DisplayObjectRenderer>
</s:Application>]]>
Strange behavior likely with 2D Collide and/or BoundingBox actions http://flintparticles.org/forum/comments.php?DiscussionID=489&Focus=1648#Comment_1648 2011-05-26T08:36:32+01:00 2011-05-26T08:37:58+01:00 Richard http://flintparticles.org/forum/account.php?u=1 Hi Colin To improve performance on collisions and other algorithms that involve interactions between particles the particles are sorted based on their x coordinate. As a result, when these ...
To improve performance on collisions and other algorithms that involve interactions between particles the particles are sorted based on their x coordinate. As a result, when these algorithms are applied small errors occur because they are applied to the particles on the left side of the screen first. Most of the time the error is unnoticeable, but occasionally it is apparent, as you found in your example.

Your message prompted me to find a solution, and the one that has minimal impact on the performance is to alternate the direction in which the particles are processed, applying them left to right in one frame and then right to left in the next. I've implemented the fix and it's in the Github repository. The commit information is here.]]>