// private Vector3 getBounceLocation(rlbot.flat.BallPrediction prediction) //{ // for (int i = 0; i < prediction.SlicesLength; i++) // { // Vector3 point = fromFramework(prediction.Slices(i).Value.Physics.Value.Location.Value); // if (point.Z < 125) // { // renderPrediction(prediction, 0, i, System.Windows.Media.Color.FromRgb(255, 0, 255)); // return point; // } // } // return fromFramework(prediction.Slices(0).Value.Physics.Value.Location.Value); // } //private Vector3 getHitPoint(rlbot.flat.GameTickPacket gameTickPacket, rlbot.flat.BallPrediction prediction) //{ // Vector3 carLocation = fromFramework(gameTickPacket.Players(this.index).Value.Physics.Value.Location.Value); // double u = fromFramework(gameTickPacket.Players(this.index).Value.Physics.Value.Velocity.Value).Length(); // // Estimate the maximum velocity. // double maxV = Math.Max(1410, Math.Min(2300, u + 150 * gameTickPacket.Players(this.index).Value.Boost)); // for (int i = 0; i < prediction.SlicesLength; i++) // { // Vector3 point = fromFramework(prediction.Slices(i).Value.Physics.Value.Location.Value); // double s = Vector3.Distance(point, carLocation) - 92.75; // double t = (double)i / 60D; // double v = 2D * (s / t) - u; // double a = (Math.Pow(v, 2) - Math.Pow(u, 2)) / (2 * s); // if (v <= maxV && a < 1700) // Approximate max acceleration. // { // renderPrediction(prediction, 0, i, System.Windows.Media.Color.FromRgb(255, 255, 255)); // return point; // } // } // return fromFramework(prediction.Slices(0).Value.Physics.Value.Location.Value); //} private Vector3?getClosestBoost(rlbot.flat.GameTickPacket gameTickPacket, Vector3 carLocation) { Vector3?closest = null; double closestDistance = 0; for (int i = 0; i < gameTickPacket.BoostPadStatesLength; i++) { rlbot.flat.BoostPadState boostPadState = (rlbot.flat.BoostPadState)gameTickPacket.BoostPadStates(i); Vector3 boostPosition = GetFieldInfo().BoostPads[i].Location; double boostDistance = Utils.getDistance2D(carLocation.X, boostPosition.X, carLocation.Y, boostPosition.Y); if (boostPadState.IsActive && /*boostPosition.IsFullBoost && */ (closest == null || closestDistance > boostDistance)) { closestDistance = boostDistance; closest = boostPosition; } } return(closest); }
private Vector3?getClosestBoost(rlbot.flat.GameTickPacket gameTickPacket, Vector3 carLocation) { Vector3?closest = null; double closestDistance = 0; for (int i = 0; i < gameTickPacket.BoostPadStatesLength; i++) { rlbot.flat.BoostPadState boostPadState = (rlbot.flat.BoostPadState)gameTickPacket.BoostPadStates(i); rlbot.flat.BoostPad boostPosition = (rlbot.flat.BoostPad)GetFieldInfo().BoostPads(i); double boostDistance = getDistance2D(carLocation.X, boostPosition.Location.Value.X, carLocation.Y, boostPosition.Location.Value.Y); if (boostPadState.IsActive && boostPosition.IsFullBoost && (closest == null || closestDistance > boostDistance)) { closestDistance = boostDistance; closest = fromFramework((rlbot.flat.Vector3)boostPosition.Location); } } return(closest); }
public BoostPadState(rlbot.flat.BoostPadState boostPadState) { Timer = boostPadState.Timer; IsActive = boostPadState.IsActive; }