public void CustomAwake(MemoryBridge memoryBridge) { this.memoryBridge = memoryBridge; IRmanager = gameObject.GetComponent <IR_Manager>(); IRmanager.CustomAwake(memoryBridge, memoryBridge.vesselControl, ref limbs); Debug.Log("IR Manager Enabled, Limb Count : " + limbs.Count); if (limbs.Count == 6) { Debug.Log("robot is a hexapod"); groupLeft = new HexapodLimbGroup(); groupLeft.limbs = new List <LimbController>(); groupRight = new HexapodLimbGroup(); groupRight.limbs = new List <LimbController>(); } foreach (var limb in limbs) { limb.roboticController = this; var offset = memoryBridge.vesselControl.vessel.transform.InverseTransformPoint(limb.transform.position); Debug.Log(limb.name); var group = groupRight; if (offset.x > 0) { Debug.Log("left leg found"); group = groupLeft; } group.limbs.Add(limb); if (limb.name.Contains("1")) { Debug.Log("limb one found"); group.limb0 = limb; } if (limb.name.Contains("2")) { Debug.Log("limb two found"); group.limb1 = limb; } if (limb.name.Contains("3")) { Debug.Log("limb three found"); group.limb2 = limb; } if (offset.x > 0) { groupLeft = group; } else { groupRight = group; } } }
//public AnimationCurve myCurve; public void CustomAwake(MemoryBridge memoryBridge) { this.memoryBridge = memoryBridge; vesselControl = memoryBridge.vesselControl; IRmanager = gameObject.GetComponent <IR_Manager>(); //convert IR parts on this vessel to robotic servos and create limbcontroller/limbs IRmanager.CustomAwake(memoryBridge, memoryBridge.vesselControl, ref limbs); steeringPID = new PidController(1, 0, .3f, .3, -.3f); steeringPID.SetPoint = 0; Debug.Log("IR Manager Enabled, Limb Count : " + limbs.Count); if (limbs.Count == 6) { Debug.Log("robot is a hexapod"); groupLeft = new HexapodLimbGroup(); groupLeft.limbs = new List <LimbController>(); groupRight = new HexapodLimbGroup(); groupRight.limbs = new List <LimbController>(); group0 = new HexapodLimbGroup(); group0.limbs = new List <LimbController>(); group1 = new HexapodLimbGroup(); group1.limbs = new List <LimbController>(); foreach (var limb in limbs) { limb.roboticController = this; var offset = memoryBridge.vesselControl.vessel.transform.InverseTransformPoint(limb.transform.position); Debug.Log(limb.name); var group = groupRight; if (offset.x < 0) { Debug.Log("left leg found"); group = groupLeft; } group.limbs.Add(limb); if (limb.name.Contains("1")) { Debug.Log("limb one found"); group.limb0 = limb; } if (limb.name.Contains("2")) { Debug.Log("limb two found"); group.limb1 = limb; } if (limb.name.Contains("3")) { Debug.Log("limb three found"); group.limb2 = limb; } if (offset.x < 0) { groupLeft = group; } else { groupRight = group; } } foreach (var item in groupRight.limbs) { Debug.Log(item.name); } group0.limbs.Add(groupLeft.limb0); group0.limbs.Add(groupLeft.limb2); group0.limbs.Add(groupRight.limb1); group1.limbs.Add(groupRight.limb0); group1.limbs.Add(groupRight.limb2); group1.limbs.Add(groupLeft.limb1); foreach (var limb in groupLeft.limbs) { Debug.Log("Group Left Limb : " + limb.name); } foreach (var limb in groupRight.limbs) { Debug.Log("Group Right Limb : " + limb.name); } } }