Does Bullet auto-remove bodies once settled?

About Monkey 2 Forums Monkey 2 Programming Help Does Bullet auto-remove bodies once settled?

This topic contains 5 replies, has 2 voices, and was last updated by  DruggedBunny 1 year, 5 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #12864

    DruggedBunny
    Participant

    This little demo builds a wall of blocks, and if you hold B it applies a vertical force to all blocks.

    If you press it before all blocks have settled, they rise up as expected.

    However, if you just run it and let the blocks settle (leave for 5 seconds or so), they don’t respond to B, even though the list count shows all the objects are present.

    If you run it and boost them into the air, then wait until all are settled (again, leave for around 5 seconds), they no longer respond.

    As I see it, either something’s wrong in my logic (no way!!), or Bullet is auto-removing/deactivating the rigid bodies from the simulation 5 seconds or so after they’ve settled.

    It’s not down to UpdateBoxes (this can be commented out) or rebuilding the wall via Space bar, as if you do nothing my PhysBox removal logic isn’t even activated.

    EDIT: Fixed

    #12865

    DruggedBunny
    Participant

    Actually, they’re (apparently) being deactivated, not removed from the simulation — if some stop responding but others are still active (you need some settled on the ground for 5 seconds, while some are still in the air, to create this situation), they can be brought back into play when hit by others.

    I assume this is some default Bullet setup…

    It can also be way less than 5 seconds…

    (If all are settled and non-responsive, BTW, hit Space to rebuild the wall and thereby bring all boxes into play.)

    #12866

    DruggedBunny
    Participant

    Updated code to drop new boxes on hitting D — run the program, let boxes settle for 5 seconds, confirm no longer responding to B, then drop a box so it collides. They will now respond to B.

    #12868

    Simon Armstrong
    Participant

    according to this a call to btCollisionObject::activate() might be needed to get the behavior you are after

    #12869

    DruggedBunny
    Participant

    Looks good, thanks, Simon… will see if we have access to it later!

    #12873

    DruggedBunny
    Participant

    OK, fixed this (thanks, skidracer!)…

    1) Added #Import “<bullet>”

    2) Added body.btBody.setActivationState (bullet.DISABLE_DEACTIVATION) in PhysBox.Start ()

    I suppose it’s just because it’s early days, but guess RigidBody would eventually expand to give more direct access to the rest of this stuff — it took a little bit of digging around in the source, and I don’t know what might get made private over time.

    (I get that making most bodies sleep is expected, BTW!)

    Reading Bullet resources online today, hope to see constraints come in next, and I notice there’s a built-in vehicle class — would be awesome to see that in mojo3d as standard (with demo, cough)!

    Stiil, early days and plenty to learn with what’s there…

    Code at top updated.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.