public void DoPrediction() { if (ballReference == null || activePaddle == null) { return; //can't do predictions because scripts are not initialised/can't find ball } timeSinceLastPrediction = 0; predictionInfo = ballReference.DoPrediction(activePaddle.paddlePosition); if (predictionInfo.success) { //Debug.Log("PREDICTION SUCCESS !!!!!!!!!!!!!"); predictedHitPoint = predictionInfo.finalHitPoint; Debug.DrawLine(transform.position, predictedHitPoint, Color.yellow, .2f); /* prediction confidence not working * if (predictionInfo.bounces == 0) //if only one bounce and a success, do another prediction to confirm it's accuracy * { * if (doConfirmPrediction == true) //if we already started a confirmation request * { * if (hitPointToConfirm == predictedHitPoint) predictionConfidence = 3; //prediction is the same, confidence is high, no need for more predictions * doConfirmPrediction = false; //remove confirmation request * hitPointToConfirm = Vector3.zero; * } * else * { * doConfirmPrediction = true; //if we have not started a confirmation request, request one * hitPointToConfirm = predictedHitPoint; * } * * } * else * { * if (doConfirmPrediction == true) * { * doConfirmPrediction = false; //if we return more than on bounce on confirmation prediction was not accurate * hitPointToConfirm = Vector3.zero; * predictionConfidence = 0; * } * } * if (predictionInfo.bounces == 1) predictionConfidence = 1; * if (predictionInfo.bounces > 3) predictionConfidence = 2; */ } else { //Debug.Log("PREDICTION Failure !!!!!!!!!!!!!"); if (predictionInfo.bounces > 2) { predictedHitPoint = Vector3.zero; } predictionConfidence = 0; } }