weld joints have no removeSelf()

Been beating my head against the wall, using the bridge demo to see why that works and my code doesn’t.
If I make a pivot joint I can remove it, but a weld throws a “removeSelf() is nil” when I try that… docs say they all have that available.
Working around it seeing if I can get the same effect with other joints, but it’s going to take time and testing to make it work. [import]uid: 5210 topic_id: 4775 reply_id: 304775[/import]

I have the same problem. Using pivot joints, I can remove them with removeSelf(). Switching to weld joints, it crashes.

I also see a performance hit when using 20 pivot joints. Switching those to weld joints speeds things up considerably, at the expense of not being able to remove them. [import]uid: 8673 topic_id: 4775 reply_id: 15814[/import]

I was able to work around it using pivots with constraints on range of motion to get a similar effect, but you are right the performance does seem to suffer with that.

I haven’t really tried optimizing much of anything yet so I’m not sure that is the source of my problems.

Really would be nice to have the weld joints match the documentation… hint hint…
[import]uid: 5210 topic_id: 4775 reply_id: 15833[/import]

I’m glad you were able to work around the problem. If the performance of pivot joints is fixed then I can do everything with those, but if not, I’ll need the weld joints to be able to remove themselves.
Strange that pivot joints would be slow, but weld joints aren’t. [import]uid: 8673 topic_id: 4775 reply_id: 15844[/import]

I’m thinking that the additional overhead of handling the range and or constrained range along with it’s effects on physics engine would make it a bit slower.

I haven’t checked the box2D docs to see if there is anything special about welds, maybe the underlying framework assumes a weld is a “weld” and can’t be broken ?

Maybe that simplifies some other aspects in the physics model ?

Or maybe it’s just an oversight in the Lua interface to the library… [import]uid: 5210 topic_id: 4775 reply_id: 15846[/import]

I checked the box2D docs and they don’t seem to imply that weld joints are “indestructable”… should be easy to implement a removeSelf() for that… again with the hinting…

------------- from box2D docs --------------

8.12 Weld Joint

The weld joint attempts to constrain all relative motion between two bodies. See the Cantilever demo in the testbed to see how the weld joint behaves.

It is tempting to use the weld joint to define breakable structures. However, the Box2D solver is iterative so the joints are a bit soft. So chains of bodies connected by weld joints will flex.

Instead it is better to create breakable bodies starting with a single body with multiple fixtures. When the body breaks, you can destroy a fixture and recreate it on a new body. See the Breakable example in the testbed. [import]uid: 5210 topic_id: 4775 reply_id: 16141[/import]

I’ve also fallen foul of this!

Has this been fixed, or been looked at?

It’s pretty annoying, particularly as trying to remove them was causing the simulator to crash with the following unhelpful message:

WARNING: Simulator does not support accelerometer events  
Assertion failed: (L-\>top \< L-\>ci-\>top), function lua\_pushlstring, file /Users/ansca/.hudson/jobs/Main-DMG/workspace/platform/mac/../../external/lua-5.1.3/src/lapi.c, line 450.  
./Corona Terminal: line 9: 785 Abort trap "$path/Corona Simulator.app/Contents/MacOS/Corona Simulator" $\*  

It’d also be nice if such error messages were a bit more intelligible :frowning: [import]uid: 11757 topic_id: 4775 reply_id: 23875[/import]

subscribe! [import]uid: 55806 topic_id: 4775 reply_id: 34558[/import]