onMount method
Called when the owning node enters a live scene graph.
Implementation
@override
void onMount() {
final world = findAncestorWorld(node);
if (world == null) {
throw StateError(
'Joint mounted with no PhysicsWorld on an ancestor node',
);
}
if (!world.simulation.supportsJoints) {
throw UnsupportedError('${world.backendName} has no joints');
}
_world = world;
_bodyA = _resolveBody(node, 'own');
final other = otherNode;
if (other != null) {
_bodyB = _resolveBody(other, 'other');
} else {
_bodyB = _anchorHandle = world.simulation.createAnchorBody();
}
_handle = world.simulation.createJoint(
buildDesc(_bodyA, _bodyB, _collisionsEnabled),
);
}