I faced with problem while trying to connect nodes with HingeJoind2D dynamically from code. Using CC 3.8.1.
Simplest example. Created 4 nodes in CC editor, put RigidBody2D and BoxCollider2D components on every node.
Then connect 2 of them with HingeJoin2D with adding component in editor. This nodes are connected properly after run.
Other two nodes I am trying to connect from code:
const b1 = find('Canvas/body1'); const b2 = find('Canvas/body2'); const body1 = b1.getComponent(RigidBody2D); const joint = b2.addComponent(HingeJoint2D); joint.connectedBody = body1;
But it does not work. HingeJoint2D connects Node to center of physical world, how I understand. Checking nodes objects state in console showing everything setted properly.
Tryed to set anchors and change other parameters but nothing helps, it wont even change anchors in fact.
Also its not only HingeJoint2D problem, I have tried other types of Joint2D.
What is wrong here?