Disabling and enabling bodies

Hi,

I have a requirement I don’t know how to achieve after reading a lot.

The oversimplified situation is that I have a heap of six squared bodies forming a straight column. By necessities of the game I have to “disable” temporally while you are dragging some other object so that you can’t collapse the column.

I tried to set the isBodyActive as false to each of the six bodies forming the column while dragging and it works.

The problem is that when I reset the isBodyActive as true, the column oscillates slightly moving the squared bodies a bit (almost inappreciable). So if I repeatedly “enable” and “disable” the column it ends up falling down.

The same situation is observed when changing the body type from “static” to “dynamic”

I tried changing the density, friction, etc. and it always eventually collapses.

Any idea?

Thanks in advance.

Isidro [import]uid: 53514 topic_id: 9884 reply_id: 309884[/import]

maybye, if no other collisions are to be performed, you can try physics.pause, and physics.play after that [import]uid: 44010 topic_id: 9884 reply_id: 36064[/import]

I have more collisions, in fact the “dragged” object must interact with all the physics objects but the column.

If it is not possible, I’ll destroy the dragged object in the precollision event keeping always the colum active… although I don’t like it at all.

Thanks [import]uid: 53514 topic_id: 9884 reply_id: 36069[/import]

Can you do something along the lines of isidrogarciaher with a precollision method?

Similar to the doodle jump example, you have a precollision method that will turn the column.isSensor = true and revert it in a post collision method.

Hope that helps! [import]uid: 49205 topic_id: 9884 reply_id: 36091[/import]

If I turn the column.isSensor to true, it goes throw the ground as it is dynamic. I’ll check the doodle jump example for new ideas.

Anyways for the moment I am destroying the objects that touch the column.

Thanks [import]uid: 53514 topic_id: 9884 reply_id: 36414[/import]

Try setting a timer to fire after, say, 2 seconds. When it does, set all the inertial values to 0 - linear velocity, etc.

In my game (Tiltopolis) I was noticing excessive bounce, so I started doing this. What I ended up doing was actually applying an upwards linear force on collision. It didn’t stop the force of the blocks when they land, but it dampened it and gives a slightly better visual aesthetic.

You could also use a piston joint from the bottom block. This won’t stop the blocks from moving, but will keep them in line, vertically. It’s then up to you to decide to remove the piston at some point, perhaps when a collision occurs with one of the blocks which isn’t with another block? [import]uid: 8271 topic_id: 9884 reply_id: 36418[/import]

Did you try setting the angularDamping and linearDamping to ridiculously high values? (like 99999999999999). [import]uid: 51516 topic_id: 9884 reply_id: 36420[/import]