Flint Particle System Forum - Strange behavior likely with 2D Collide and/or BoundingBox actions2016-05-08T00:34:48+01:00http://flintparticles.org/forum/
Lussumo Vanilla & Feed Publisher
Strange behavior likely with 2D Collide and/or BoundingBox actionshttp://flintparticles.org/forum/comments.php?DiscussionID=489&Focus=1647#Comment_16472011-05-24T22:20:59+01:002016-05-08T00:34:48+01:00Colinhttp://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.
<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 actionshttp://flintparticles.org/forum/comments.php?DiscussionID=489&Focus=1648#Comment_16482011-05-26T08:36:32+01:002011-05-26T08:37:58+01:00Richardhttp://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.]]>