void UpdateFromParamsAndApply(Attachment attachment) { if (!IsConnected(attachment)) { return; } AttachObject jointed = GetJointedObject(attachment); AttachObject connected = GetConnectedObject(attachment); // fixme - need to only update anchors if they have actually changed (same as 2D)? PhysicsAttachStrategyHelper.CreateOrApplyAllJoints(jointed, connected, jointDescriptions, null, 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; PhysicsAttachStrategyHelper.CreateOrApplyAllJoints(leaf, root, jointDescriptions, leaf, 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 PhysicsAttachStrategyHelper.CreateOrApplyAllJoints(nextLink, link, jointDescriptions, nextLink, hideJointsInInspector); } }
protected override void DisconnectBoth(AttachObject jointed, AttachObject connected) { PhysicsAttachStrategyHelper.DestroyJoints(jointed); }
protected override void ConnectBoth(AttachObject jointed, AttachObject connected) { PhysicsAttachStrategyHelper.CreateOrApplyAllJoints(jointed, connected, jointDescriptions, null, hideJointsInInspector); }
protected override void DisconnectLeaf(AttachObject root, AttachObject leaf) { PhysicsAttachStrategyHelper.DestroyJoints(leaf); }
protected override void ConnectLeaf(AttachObject root, AttachObject leaf) { PhysicsAttachStrategyHelper.CreateOrApplyAllJoints(leaf, root, jointDescriptions, leaf, hideJointsInInspector); }
protected override void DisconnectLinks(AttachObject link, AttachObject nextLink) { PhysicsAttachStrategyHelper.DestroyJoints(nextLink); }
protected override void ConnectLinks(AttachObject link, AttachObject nextLink) { // put the joint on nextLink - so it is also the reference object PhysicsAttachStrategyHelper.CreateOrApplyAllJoints(nextLink, link, jointDescriptions, nextLink, hideJointsInInspector); }