Physics Elasticity while crushing Objects

Get help using Construct 2

Post » Mon May 05, 2014 12:51 am

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!
B
24
S
4
G
1
Posts: 177
Reputation: 1,827

Post » Mon May 05, 2014 8:32 am

Hi, could you post a capx ?
B
47
S
16
G
9
Posts: 1,097
Reputation: 11,180

Post » Mon May 05, 2014 10:56 am

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.
You do not have the required permissions to view the files attached to this post.
B
24
S
4
G
1
Posts: 177
Reputation: 1,827

Post » Mon May 05, 2014 11:12 am

@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 ?
B
47
S
16
G
9
Posts: 1,097
Reputation: 11,180

Post » Mon May 05, 2014 11:31 am

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.
B
24
S
4
G
1
Posts: 177
Reputation: 1,827

Post » Mon May 05, 2014 2:33 pm

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 do not have the required permissions to view the files attached to this post.
B
47
S
16
G
9
Posts: 1,097
Reputation: 11,180

Post » Mon May 05, 2014 3:38 pm

You could try making them physics immovable on touch end. Might work... (Using phone so I can't test).
A big fan of JavaScript.
B
74
S
20
G
69
Posts: 2,205
Reputation: 43,832

Post » Mon May 05, 2014 11:22 pm

spongehammer wrote: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!
B
24
S
4
G
1
Posts: 177
Reputation: 1,827

Post » Mon May 05, 2014 11:36 pm

Colludium wrote: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.
You do not have the required permissions to view the files attached to this post.
B
24
S
4
G
1
Posts: 177
Reputation: 1,827

Post » Tue May 06, 2014 12:15 am

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.
A big fan of JavaScript.
B
74
S
20
G
69
Posts: 2,205
Reputation: 43,832

Next

Return to How do I....?

Who is online

Users browsing this forum: Fradno, Google [Bot] and 15 guests