/// <summary> /// Called once every physics step (framerate independent) to drive motor joints as well as handle the resetting of the robot /// </summary> void FixedUpdate() { if (rootNode != null && ControlsEnabled) { if (Packet != null) { DriveJoints.UpdateAllMotors(rootNode, Packet.dio, controlIndex, MixAndMatchMode.GetMecanum()); } else { DriveJoints.UpdateAllMotors(rootNode, emptyDIO, controlIndex, MixAndMatchMode.GetMecanum()); } int isMixAndMatch = PlayerPrefs.GetInt("mixAndMatch", 0); //0 is false, 1 is true //If the robot is in Mix and Match mode and has a manipulator, update the manipulator motors if (robotHasManipulator == 1 && isMixAndMatch == 1) { Debug.Log("Manipulator should be moving"); DriveJoints.UpdateManipulatorMotors(manipulatorNode, emptyDIO, controlIndex, MixAndMatchMode.GetMecanum()); } } if (IsResetting) { Resetting(); } UpdateStats(); }
/// <summary> /// Called once every physics step (framerate independent) to drive motor joints as well as handle the resetting of the robot /// </summary> void FixedUpdate() { if (rootNode != null && ControlsEnabled) { if (Packet != null) { DriveJoints.UpdateAllMotors(rootNode, Packet.dio, controlIndex, MixAndMatchMode.GetMecanum()); } else { DriveJoints.UpdateAllMotors(rootNode, new UnityPacket.OutputStatePacket.DIOModule[2], controlIndex, MixAndMatchMode.GetMecanum()); } if (MixAndMatchMode.hasManipulator) { DriveJoints.UpdateAllMotors(manipulatorNode, new UnityPacket.OutputStatePacket.DIOModule[2], controlIndex, MixAndMatchMode.GetMecanum()); } } if (IsResetting) { Resetting(); } }