/// <summary> /// Updates pwm information and sends robot information to the server. /// </summary> private void FixedUpdate() { base.UpdatePhysics(); BRigidBody rigidBody = GetComponentInChildren <BRigidBody>(); if (rigidBody == null) { return; } if (isLocalPlayer) { float[] pwm = DriveJoints.GetPwmValues(Packet == null ? emptyDIO : Packet.dio, ControlIndex, false); if (isServer) { RpcUpdateRobotInfo(pwm); } else { CmdUpdateRobotInfo(pwm); } if (InputControl.GetButton(Controls.buttons[ControlIndex].resetRobot)) { CmdResetRobot(); } } if (isServer && serverCanSendUpdate) { RemoteUpdateTransforms(); } }
/// <summary> /// Updates pwm information and sends robot information to the server. /// </summary> private void FixedUpdate() { base.UpdatePhysics(); BRigidBody rigidBody = GetComponentInChildren <BRigidBody>(); if (rigidBody == null) { return; } if (isLocalPlayer) { float[] pwm = DriveJoints.GetPwmValues(Packet == null ? emptyDIO : Packet.dio, ControlIndex, false); if (correctionEnabled) { if (isServer) { RpcUpdateRobotInfo(pwm); } else { CmdUpdateRobotInfo(pwm); } } } if (isServer && serverCanSendUpdate && correctionEnabled) { RemoteUpdateTransforms(); } }
/// <summary> /// Updates all motors on the robot. /// </summary> protected virtual void UpdateMotors(float[] pwm = null) { DriveJoints.UpdateAllMotors(RootNode, pwm ?? DriveJoints.GetPwmValues(Packet == null ? emptyDIO : Packet.dio, ControlIndex, IsMecanum()), emuList); }