Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Box2d create breakable joints for dynamic body

Have been working on building a Bridge builder using box2d.

Basically you build a bridge and stress test it by passing objects on top of it. The joints break if the stress applied is high.

Can you please help how best to join the b2Body. Have tried revolute joint, but they are not breaking. Any suggestions.

Thanks

like image 642
MountainRock Avatar asked Jan 24 '26 08:01

MountainRock


2 Answers

"You can get the reaction force and torque off the joint. You can query these forces after each time step and destroy the joint when your threshold is exceeded." - Quote from Erin Catto - http://www.box2d.org/forum/viewtopic.php?f=3&t=1079

like image 129
Yomadorr Avatar answered Jan 25 '26 21:01

Yomadorr


I think the joints will not break by themselves. You have to break them using DestroyJoint function. You can setup b2ContactListener and get the impulse velocity of the object that hits your bridge and you can take the decision if you want to break the joint or not.

like image 27
Tayyab Avatar answered Jan 25 '26 21:01

Tayyab