Physics Elasticity while crushing Objects

  • Hello!

    I have a few objects on the screen, all in line. If I move the object that is at the end of the line and move it towards the others, almost crushing them on the wall by the other end of the line, seems like all of them get a little bit closer to each other.

    The problem here is that if I let the first (moving) object go, the others start doing some kind of spring movement.. expanding. As if they were compressed before... and visually they were compressed.

    What I think I need here is that the system stop doing this compression between the objects. They just get closer to each other and that is it.

    I have 4 movable objects and they are all the same:

    • Immovable: No
    • Collision mask: Use collision
    • Density: 1
    • Friction: 0.9
    • Elasticity: 0
    • Angular damping: 0.01
    • Bullet: No
    • Initial state: Enabled

    The wall:

    • Immovable: Yes
    • Collision mask: User collision
    • Density: 1
    • Friction: 0.5
    • Elasticity: 0
    • Linear damping: 0
    • Angular damping: 0
    • Bullet: No
    • Initial state: Enabled

    Any tips?

    Thanks!

  • Hi, could you post a capx ?

  • Of course! There you go!

    Notice, I have changed the object Alpha sou you can see them overlapping each other (this cannot be... I even tried to change the density but it didn't work).

    When you drag one of the sprite and press te group to the wall and them release the touch, the sprites are pushed back.

  • henriquesv

    I am not really sure what you're trying to achieve here. What do you want to happen ? Do you want to move all the tokens together ?

  • The capx didn't get so good. The sprites were supposed to be independent. Either way, suppose they are independent (I made this capx really fast). When dragging one sprite that is pushing all the other sprites to the wall, the blocking wall must only stop them. After releasing the touch, I don't want the sprites to be pushed back.

    Give it a try, it makes an effect like a slingshot.

  • I think this is what your experiencing..

    It's due to the nature of the physics behaviour. Solids cant occupy the same space so will always attempt to "push out" when they are forced to overlap. I dont see any way around this other than avoiding using physics.

  • You could try making them physics immovable on touch end. Might work... (Using phone so I can't test).

  • I think this is what your experiencing..

    It's due to the nature of the physics behaviour. Solids cant occupy the same space so will always attempt to "push out" when they are forced to overlap. I dont see any way around this other than avoiding using physics.

    Spongehammer, I tried to open the capx but I need the "TouchMouse" plugin by Rex Rainbow. I have looked everywhere .. the forum, google and I couln't find it. Could you upload it here?

    Thanks!

  • You could try making them physics immovable on touch end. Might work... (Using phone so I can't test).

    Hi Colludium, thanks for your contribution.

    I just what you said. First I tried just making them immovable and it really happens. Then I also added an action to make them movable again on every tick. This solution avoids the slingshot effet. But the objects keep overlapping each other =(

    I have attached an image of the EventSheet and final state.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi henriquesv, I've had a play around with this but can't find a slick way to get a touch-drag to work effectively on an object with physics behavior. Box2D will simulate the real world for games, but the objects have to be allowed to be springy for it to do its job. NB on your event sheet above, line 7 will undo the command of line 6... Sorry, not much help yet.

  • Ok Colludium ! Thanks for the help! I'll keep looking for a work-around! =)

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