// Use this for initialization void Start() { AGXUnity.Constraint[] constraints = GetComponentsInChildren <AGXUnity.Constraint>(); m_winch = GetComponentInChildren <WireWinch>(); m_lockJoints = new List <Constraint>(); foreach (var c in constraints) { if (c.Type == ConstraintType.LockJoint) { m_lockJoints.Add(c); } } }
/// <summary> /// When the user is changing node type, e.g., between fixed and winch, /// we receive a callback handling winch dependencies. /// </summary> private void OnNodeType() { if (m_winch != null) { if (Wire == null || Type != Wire.NodeType.WinchNode) { ScriptComponent.DestroyImmediate(m_winch); m_winch = null; } } else if (Wire != null && Type == Wire.NodeType.WinchNode) { m_winch = Wire.gameObject.AddComponent <WireWinch>(); m_winch.Wire = Wire; } }