How do I find out with chipmunk joints?

0 favourites
  • 10 posts
From the Asset Store
Use this game pack to create your own game, modify the existing game or simply take a look and see how it was made.
  • youtube.com/watch

    Hi, I need help on the joints. As you can see in the screenshots, I create something like microorganism fluid forms. At this stage, I ran into a problem: the cells repel each other and do not want to live together as a single substance. What additional commands should be used? How can I do to cells could be added, the body grow, and being lived in one form? In principle, it does not matter, it will be liquid or not, the main thing - is that growth is on the cells, as well as destruction.

    Still I am trying to make sure that they are not repelled by each other like mad, but do not pass through each other. Any idea how to do it?

    Sorry for my English, I myself am from Russia.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • any help?

  • As stated here..

    Please be patient while waiting for response..

    Not everybody is online all the time..

    Your question is about chipmunk physics, which is a third party plugin not many people use, so the amount of people able to answer your question isn't really big..

    I guess your best bet would be to wait for R0J0hound

  • Paramonov

    I don't think chipmunk is going to be fast enough for any kind of fluid simulation with particle attraction forces. I had a go & couldn't get anything to work with decent frame rates - here's my best attempt:

    https://dl.dropboxusercontent.com/u/523 ... nTest.capx

  • Paramonov

    I don't think chipmunk is going to be fast enough for any kind of fluid simulation with particle attraction forces. I had a go & couldn't get anything to work with decent frame rates - here's my best attempt:

    https://dl.dropboxusercontent.com/u/523 ... nTest.capx

    Unfortunately, I could not open the file due to an older version (not yet updated), but thanks anyway. I need it chipmunk as the assurances of developers - it is faster than a regular physics. A physics apply in general to essentially necessary that it interacted with the rest of the world.

  • Joints won't help in this case, and in your image you're creating a joint with itself which does nothing. what you want is to apply a force to all the objects to an average center. Here's one way:

    global number centerx=0
    global number centery=0
    
    every tick
    --- set centerx to 0
    --- set centery to 0
    
    for each sprite
    --- add sprite.x to centerx
    --- add sprite.y to centery
    
    every tick
    --- set centerx to centerx/sprite.count
    --- set centery to centery/sprite.count
    --- sprite: apply force polar(angle(self.x,self.y,centerx,centery), 100)[/code:1187k6ok]
    
    I used a force of 100 but that could be changed.  You could even make it proportionate with the distance from the center.  
    Further ideas include applying the force to the average center of only the particles in a radius around each particle.  You could also do a repelling force between the sprites to keep them away from each other.  It would give more of a fluid motion.  You'd have to tweak it in such a way so the attracting and repelling forces balance.
    
    Here's some fluid experiments i'be done before:
    [url=https://www.scirra.com/forum/viewtopic.php?f=147&t=116854&p=842125&hilit=fluid#p842125]viewtopic.php?f=147&t=116854&p=842125&hilit=fluid#p842125[/url]
    
    And here's one from today:
    [url=https://dl.dropboxusercontent.com/u/5426011/examples31/chipmunk_blob.capx]https://dl.dropboxusercontent.com/u/542 ... _blob.capx[/url]
    To make it more fluid like I made the sprites be in a collision group to disable collisions between each other.  Then I compared the distances between each pair and repel or attract depending on the distance.  The forces are proportionate to the distances using a spring equation: Force=-k*displacement.  To add to the stability I gave the sprites a max speed.  Also I readjusted their positions when they get to close since the force when the objects are almost on top of each other will send the sprites flying.
    
    One thing I haven't tried that's used in fluid simulations is velocity smoothing.  Basically you average out the velocity of the particles around another particle, where the weight they have in the average depends on the distance.
  • One thing I haven't tried that's used in fluid simulations is velocity smoothing. Basically you average out the velocity of the particles around another particle, where the weight they have in the average depends on the distance.

    Your example is super, i will using some ideas from the distance. But you are a bit misunderstood my message. I'm not trying to make a liquid - I create a world with lots of organisms, and apply all the forces of physics for all I have not included in the plans. Well, I'm talking about the first three examples. And I'm trying to do it all with dynamic figures, now I will explain.

    That is the concept like this: there is a cell, it is divided, creating around himself another cell, and so on. These cells create a single microorganism having the force of movement ONLY FROM the original CELL.

    That is the idea with joints look more than attractive. I also wanted to cover all the cells of some plastic shell, but the features of the program is not allowed. In your example, I try to think of something, but unfortunately, it is very clumsy method, because the body - it's not a bunch of rabid cells. In general, I will make its source code, look, if not more difficult.

    rghost.ru/download/88VG78Mfb/d47282a5a6229200290acfaaaabd072f5a6227db/Evo2.capx

  • I don't have all the plugins required to open your capx. If you want to attach objects together like that then yeah, joints would work. There are probably some examples in the forum that do that.

    If the original cell is the same object type as the other cells then you'll need to do a forum search on how to pick two different instances of the same type so you can attach one to the other.

    Once you can do that then the pivot joint combined with a gear joint is a useful way to attach two objects together (there's an example of this in the chipmunk topic). If the attached objects overlap at all they will jitter around so it's also to put connected objects in a collision group so the ignore collisions with each other.

  • Success! I still did what I wanted. Not quite true, but it happened.

    If it is useful, I leave scheme.

    I created an invisible grid around the cell. Every time a cell divides - it is created on the spot invisible stuff and fixed with two joints to the previous cell. Invisible stuff destroyed.

    Of course there is still much work, because me need to adjust the speed and a lot of other things, but generally work with joints over.

  • [quote:kffr6u7g]These cells create a single microorganism having the force of movement ONLY FROM the original CELL.

    If you simplify the particle attraction forces to only point towards the main cell, you can get decent performance while keeping inter-particle collisions turned on (nice idea though R0J0hound having no collisons & only forces keeping them apart, performance seems good that way). Here's a fun experiment that looks like a radioactive fried egg <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy"> https://dl.dropboxusercontent.com/u/523 ... tTest.capx

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)