Resizing A Static Edge

In my game I have doors that shrink and grow constantly. It is top down so the doors are just line segments.

The issue I have is resizing this line in Box2D. From what I have read on these forums it is not possible to resize an object while running as Box2D would have no way of knowing that it was resized. Is there any simple way to do this that I am missing?

One method that I saw was creating multiple shapes for each "length" of the door and switching them out as the door is opening or closing. Is this the best method to try? I am just looking for some input before I try to implement this.
You can create/destroy shapes. Or you can hack it and manually modify the shape. Then you will have to call b2Body::SetTransform (use the current transform) to trigger the broad-phase update.
I went ahead and just destroyed and recreated the edge in a different size and it seems to be pretty stable. My game doesn't have a ton of objects in its simulation and runs at 60 FPS so I think it should be fine.
Well in playing with it more it works except for if a ball makes contact with the moving door. The ball can seem to get "stuck" on the door, although it is not really stuck, the wall just moved inside of the ball so Box2D pushes it away, but the velocity of the ball doesn't change as it keeps going the same direction.

So it mainly just looks weird. Is there any way I can fix this issue? I change the line size every frame, could that be part of the problem?
The first thing that came to mind when I read this is, can you not just move the door object like it would in real life. Physics engines are all about recreating realistic environments as we know them from the real world, so as soon as you start trying to use a physics library to do things that don't really happen in the real world, you end up with more work and more issues, as you are finding out 🙂
Can't you slide the door out of the way somehow?

Original thread: https://box2d.org/forum/viewtopic.php?t=5754