void UpdateFromParamsAndApply(Attachment attachment) { if (!IsConnected(attachment)) { return; } AttachObject jointed = GetJointedObject(attachment); AttachObject connected = GetConnectedObject(attachment); // fixme - updating the anchors will also change a hinge joint's reference angle, which means the limits // will change if they are based on the starting rotation. :/ need to only update anchors if they have // actually changed. Physics2DAttachStrategyHelper.CreateOrApplyAllJoints(jointed, connected, jointDescriptions, null, hideJointsInInspector); }
void UpdateFromParamsAndApply(Attachment attachment) { // fixme - updating the anchors will also change a hinge joint's reference angle, which means the limits // will change if they are based on the starting rotation. :/ need to only update anchors if they have // actually changed. AttachObjectList.Enumerator e = attachment.objects.GetEnumerator(phase: AttachObjectPhase.Connected); while (e.MoveNext()) { AttachObject link = e.Current; AttachObject nextLink = GetNextLink(link); if (nextLink == null || !nextLink.isConnected) { continue; } // put the joint on nextLink - so it is also the reference object Physics2DAttachStrategyHelper.CreateOrApplyAllJoints(nextLink, link, jointDescriptions, nextLink, hideJointsInInspector); } }
void UpdateFromParamsAndApply(Attachment attachment) { AttachObject root = GetRoot(attachment); if (root == null || !root.isConnected) { return; } AttachObjectList.Enumerator e = attachment.objects.GetEnumerator(phase: AttachObjectPhase.Connected, category: (int)Categories.Leaves); while (e.MoveNext()) { AttachObject leaf = e.Current; // fixme - updating the anchors will also change a hinge joint's reference angle, which means the limits // will change if they are based on the starting rotation. :/ need to only update anchors if they have // actually changed. Physics2DAttachStrategyHelper.CreateOrApplyAllJoints(leaf, root, jointDescriptions, leaf, hideJointsInInspector); } }
protected override void DisconnectLinks(AttachObject link, AttachObject nextLink) { Physics2DAttachStrategyHelper.DestroyJoints(nextLink); }
protected override void ConnectLinks(AttachObject link, AttachObject nextLink) { // put the joint on nextLink - so it is also the reference object Physics2DAttachStrategyHelper.CreateOrApplyAllJoints(nextLink, link, jointDescriptions, nextLink, hideJointsInInspector); }
protected override void DisconnectLeaf(AttachObject root, AttachObject leaf) { Physics2DAttachStrategyHelper.DestroyJoints(leaf); }
protected override void ConnectLeaf(AttachObject root, AttachObject leaf) { Physics2DAttachStrategyHelper.CreateOrApplyAllJoints(leaf, root, jointDescriptions, leaf, hideJointsInInspector); }
protected override void ConnectBoth(AttachObject jointed, AttachObject connected) { Physics2DAttachStrategyHelper.CreateOrApplyAllJoints(jointed, connected, jointDescriptions, null, hideJointsInInspector); }
protected override void DisconnectBoth(AttachObject jointed, AttachObject connected) { Physics2DAttachStrategyHelper.DestroyJoints(jointed); }