public void attachTo(Attachment thisatch, Attachment thatatch, Object3D targetObj) { for (int i = 0; i < atch_info.Count; i++) { if (atch_info[i].thisAtch == thatatch) { atch_info.RemoveAt(i); break; } } attachmentInfo new_atif = new attachmentInfo(); new_atif.thisAtch = thisatch; new_atif.thatAtch = thatatch; new_atif.thisObject = this; new_atif.AttachedTo = targetObj; new_atif.Attach(); atch_info.Add(new_atif); }
public void Attach() { thisObject.transform = thisAtch.transform.Inverted() * thatAtch.transform * AttachedTo.transform; attachmentInfo ata = new attachmentInfo(); for (int i = 0; i < AttachedTo.atch_info.Count; i++) { if (AttachedTo.atch_info[i].thisAtch == thatAtch) { AttachedTo.atch_info.RemoveAt(i); break; } } ata.thisObject = AttachedTo; ata.thisAtch = thatAtch; ata.thatAtch = thisAtch; ata.AttachedTo = thisObject; AttachedTo.atch_info.Add(ata); }