Not signed in (Sign In)

Vanilla 1.1.9 is a product of Lussumo. More Information: Documentation, Community Support.

    •  
      CommentAuthorMathdude314 (Advanced Member)
    • CommentTimeMar 12th 2017 edited
     
    I was trying to implement a system where there were several particles all held together that could be used to form a player in a platform game, and large impacts or spike collisions could cause you to lose particles and die purely from physics, not arbitrary triggers.
    EDIT: Fixed However, it appears that if you set the attraction strength too high, it actually appears to propel itself. It would seem that the forces would counterbalance, so either there is a bug in my code or the OnEntityTimer is not being called "all at once", but rather entities are moving in between each timer evaluation.

    I have 18 particles all in one CCat that are assigned into an array. Then the timer runs every frame: it loops over all entities in the array, weeds out anything over a distance of 1 away, and then basically applies a force proportional to 1 - distance between the two particles. However, as you can see in the design the compound moves completely on its own! You would think the forces would balance out since between every pair of particles A,B the force applied to A is the negative of the force applied to B and the entire mass would gain no net force... -- FIXED

    See below for an updated version.-----------------
    If less people are active, that will only make for even less activity. Start making those designs!
    Currently working on a one-round no-elimination quick RP game...
    • CommentAuthorXyuzhg (Moderator)
    • CommentTimeMar 12th 2017 edited
     
    In your main loop, you've initialized the counter to 0, but then proceed to increment it immediately in the first iteration. So the zeroth entity in the global list is not taken into account for by other entities, hence you have asymmetry.

    An easy fix is to initialize the counter to -1. Or for better programming practice, move the increment and comparison to the end of the loop (as well as before a Continue) and do a comparison before (to prevent looping over nothing).-----------------
    Hopefully PA is inconsistent.
    •  
      CommentAuthorMathdude314 (Advanced Member)
    • CommentTimeMar 14th 2017
     
    Thanks. I usually put it at the end of the loop but I had 2 continues and I did not want to repeat the code... it would have been much better with a FOR loop.-----------------
    If less people are active, that will only make for even less activity. Start making those designs!
    Currently working on a one-round no-elimination quick RP game...
    •  
      CommentAuthorMathdude314 (Advanced Member)
    • CommentTimeMar 14th 2017
     
    This could be improved, but what I have so far is a simple key control that moves every particle. Perhaps there should be something to move only particles that are connected in some sense? This way stragglers lost from a heavy impact cannot be moved. However, the problem is what if your player splits into two blobs of sizes 8 and 10?



    Either way, I am annoyed at how flat the object can often get from heavy impacts — those impacts should shoot particles out the side, not flatten the blob...-----------------
    If less people are active, that will only make for even less activity. Start making those designs!
    Currently working on a one-round no-elimination quick RP game...
    •  
      CommentAuthorBioManiac R2 (Moderator)
    • CommentTimeMar 16th 2017
     
    Like this :P ??



    I found your force was way too weak and your distance to use it was wayy too high, so i changed both.
    I just wish the simulation didn't lag so much when I add more particles and make them smaller :(