public static double WheelTurnForEndZeroWheelTurn(this PCar car, Vector finalPos, double sign) { PCar physicCar = new PCar(car); int ticks = (int)Math.Abs(Math.Round(physicCar.WheelTurn / game.CarWheelTurnChangePerTick)); physicCar.setWheelTurn(0); physicCar.Iteration(ticks); double finalAngle = (finalPos - car.Pos).Angle; return(car.WheelTurnForEndZeroWheelTurn(finalAngle, sign)); }
private void move(Move moveResult) { PCar physicCar = new PCar(car, game); physicCar.setEnginePower(enginePowerSign); HashSet <IPhysicEvent> events = calculateMoveEvents(physicCar); if (events.ComeContaints(PhysicEventType.MapCrash) || events.ComeContaints(PhysicEventType.ObjectsCrash)) { moveResult.WheelTurn = physicCar.WheelTurnForEndZeroWheelTurn(defaultPos, speedSign); } }
public void Iteration(PCar car, int iterationCount) { for (int i = 0; i < iterationCount; i++) { if (intersecOildStickEvent.Check(car)) { car.traveledOnOil(intersecOildStickEvent.InfoForCheck as OilSlick); } double speedSign = Math.Sign(car.Dir.Dot(car.Speed)); double wheelTurn = car.WheelTurnForEndZeroWheelTurn(angle, speedSign); car.setWheelTurn(wheelTurn); car.Iteration(1); } }
public void Iteration(PCar car, int iterationCount) { for (int i = 0; i < iterationCount; i++) { if (intersecOildStickEvent.Check(car)) { car.traveledOnOil(intersecOildStickEvent.InfoForCheck as OilSlick); } double speedSign = Math.Sign(car.Dir.Dot(car.Speed)); if (double.IsNaN(finalAngle)) { car.WheelTurnForEndZeroWheelTurn(point, speedSign); } else { car.setWheelTurn(car.WheelTurnForEndZeroWheelTurnToPoint(point, finalAngle, speedSign)); } car.Iteration(1); } }