Fork me on GitHub
Not signed in (Sign In)

Welcome, Guest

Want to take part in these discussions? Sign in if you have an account, or apply for one below

    • CommentAuthorkytom
    • CommentTimeAug 10th 2009
     
    Hi,

    Thank you for the awesome particle engine. Just learning this thing, and ran into an issue...

    I want to create a certain effect based on the 'energy' of the particle, where energy is a number of its neighbors. Is there some easy way of determining it, or should I implement one myself?

    TIA and cheers :)
    • CommentAuthorRichard
    • CommentTimeAug 12th 2009
     
    Hi

    You'll probably need a custom action for this. Some of the existing actions (like ApproachNeighbours) relate to the number and location of neighbours, but it doesn't sound like you want any of the specific actions already implemented in the library. You might find the source code for ApproachNeighbours useful in implementing your own solution.

    Richard
    • CommentAuthorkytom
    • CommentTimeAug 27th 2009
     
    Sorry for the late response. Thank you for your suggestion!

    I made my own action based on ApproachNeighbours, exactly how you said, though if I wanted to optimize it better, especially in case of a large number of particles, I think the best solution would be to implement a grid-based solution, like Grant did in his ProximityManager.

    Cheers :)
    • CommentAuthorRichard
    • CommentTimeSep 1st 2009
     
    I too would have expected space partitioning to produce faster results, but when I implemented ApproachNeighbours and the other space related actions I found a simple sorted array to be faster than space partitioning. I can only assume that this is because the Array sort is implemented in the flash player and is more efficient than any space partitioning algorithm I could devise in Actionscript.