public void AddJoint(Joint joint) { if (!_jointList.Contains(joint)) { _jointList.Add(joint); } }
private void ProcessAddedItems() { //Add any new geometries for (int i = 0; i < geomAddList.Count; i++) { if (!geomList.Contains(geomAddList[i])) { geomAddList[i].isRemoved = false; geomList.Add(geomAddList[i]); //Add the new geometry to the broad phase collider. _broadPhaseCollider.Add(geomAddList[i]); } } geomAddList.Clear(); //Add any new bodies for (int i = 0; i < bodyAddList.Count; i++) { if (!bodyList.Contains(bodyAddList[i])) { bodyList.Add(bodyAddList[i]); } } bodyAddList.Clear(); //Add any new controllers for (int i = 0; i < controllerAddList.Count; i++) { if (!controllerList.Contains(controllerAddList[i])) { controllerList.Add(controllerAddList[i]); } } controllerAddList.Clear(); //Add any new joints for (int i = 0; i < jointAddList.Count; i++) { if (!jointList.Contains(jointAddList[i])) { jointList.Add(jointAddList[i]); } } jointAddList.Clear(); //Add any new springs for (int i = 0; i < springAddList.Count; i++) { if (!springList.Contains(springAddList[i])) { springList.Add(springAddList[i]); } } springAddList.Clear(); }
/// <summary> /// select/deselect all joints under `startJoint' /// </summary> public void RecurSelect(Transform startJoint, bool select) { JointList extendedJoints = SMREditor.GetExtendedJoints(); if (!extendedJoints.Contains(startJoint)) { return; } _Recur_SelectJointAndAllDescendants(startJoint, select); }
private void _Recur_SelectJointAndAllDescendants(Transform joint, bool select) { JointList extendedJoints = SMREditor.GetExtendedJoints(); if (!extendedJoints.Contains(joint)) { return; } if (select) { IncSelect(joint); } else { DecSelect(joint); } for (int idx = 0; idx < joint.childCount; ++idx) { Transform j = joint.GetChild(idx); _Recur_SelectJointAndAllDescendants(j, select); } }
/// <summary> /// Processes the added geometries, springs, joints, bodies and controllers. /// </summary> private void ProcessAddedItems() { //Add any new geometries _tempCount = _geomAddList.Count; for (int i = 0; i < _tempCount; i++) { if (!GeomList.Contains(_geomAddList[i])) { _geomAddList[i].InSimulation = true; GeomList.Add(_geomAddList[i]); //Add the new geometry to the broad phase collider. _broadPhaseCollider.Add(_geomAddList[i]); } } _geomAddList.Clear(); //Add any new bodies _tempCount = _bodyAddList.Count; for (int i = 0; i < _tempCount; i++) { if (!BodyList.Contains(_bodyAddList[i])) { BodyList.Add(_bodyAddList[i]); } } _bodyAddList.Clear(); //Add any new controllers _tempCount = _controllerAddList.Count; for (int i = 0; i < _tempCount; i++) { if (!ControllerList.Contains(_controllerAddList[i])) { ControllerList.Add(_controllerAddList[i]); } } _controllerAddList.Clear(); //Add any new joints _tempCount = _jointAddList.Count; for (int i = 0; i < _tempCount; i++) { if (!JointList.Contains(_jointAddList[i])) { JointList.Add(_jointAddList[i]); } } _jointAddList.Clear(); //Add any new springs _tempCount = _springAddList.Count; for (int i = 0; i < _tempCount; i++) { if (!SpringList.Contains(_springAddList[i])) { SpringList.Add(_springAddList[i]); } } _springAddList.Clear(); }