- Home /
Fixed joint 2D
Why is there no fixed joint 2D? I want to connect some 2D physics objects with fixed joints, which are supposed to be break-able. How do I achieve this if there are no fixed 2D joints? Parenting?
Any help is appreciated!
/Alex
Answer by Headworker · Jan 28, 2014 at 08:21 PM
Well depending on what you want to achieve parenting could be the solution.
But we need more information: How do you rigidbodies need to behave? What should trigger their seperation? If force to break them is the only possible trigger, then you got a problem, because breakforce is not (yet) implemented for rigidbody2D, at least according to my own research and the official documentation.
Possible workarounds: If you ca set up your breaking trigger event as detectable by a script (a collision with a certain relative velocity (Unity Docs, relative Velocity) you can emulate the breakforce effect. Relative velocity will return the collision velocity (sum of 2 colliding objects' velocity).
If such an event is noticed by the engine and reported to your OnCollsionEnter() function, you can then trigger a parent detachment with transform.parent = null;
If you have further questions, dont hesitate to ask!
Sorry about the lack of information. You assumed correctly. Force is supposed to break the joint. I thought about the parenting solution, but I thought it would be hard to make it behave realistically. I'll try though. Thanks!
Your answer