Показать сообщение отдельно
Старый 29.10.2025, 09:26   #1318
Asura
Модератор
 
Аватар для Asura
 
Регистрация: 28.02.2007
Адрес: Тула, Россия
Сообщений: 1,892
По умолчанию

Тогда надо добавить еще вот что;

Код:
  private float curAlt = 300.0f;
  private float curSpd = 50.0f;

  
  class Interpolater extends InterpolateRef 
  {
    public boolean tick() {
      resetYPRmodifier();
      float v = ((G_37)aircraft()).fSightCurSpeed;
      float h = ((G_37)aircraft()).fSightCurAltitude;
      curAlt = (19.0f*curAlt+h)/20.0f;
      curSpd = (19.0f*curSpd+v)/20.0f;
      mesh.chunkSetAngles("zScaleKM", 0.04f*curAlt, 0.0f, 0.0f);
      mesh.chunkSetAngles("zScaleM", 0.36f*curAlt, 0.0f, 0.0f);
      mesh.chunkSetAngles("zScaleKMH", -0.8f*(curSpd-50.0f), 0.0f, 0.0f);
      float m300 = 0.5f*(float)Math.tan(Math.atan( (300.0f/3.6f)*(Math.sqrt(2.0f*curAlt/Atmosphere.g()))/(curAlt) ));
      float m = (float)Math.tan(Math.atan( (curSpd/3.6f)*(Math.sqrt(2.0f*curAlt/Atmosphere.g()))/(curAlt) ));
      xyz[0] = -0.0005f*curAlt;
      xyz[1] = -1.0f*(m300 - m);
      mesh.chunkSetLocate("zScaleCurve", xyz, ypr);

      if (bEntered)
      {
    	  float tan = aircraft().FM.Or.getTangage();
    	  if (tan > 5f)
    		  tan = 5f;
    	  else if (tan < -5f)
    		  tan = -5f;
    	  mesh.chunkSetAngles("BlackBox", 0.0f, 0f, tan);
    	  HookPilot hook = HookPilot.cur();
          hook.setInstantOrient(aAim, tAim-tan, 0f);
      }
      
      return true;
    }
  }
  
    public void reflectWorldToInstruments ( float delta ) 
	{
		if(bEntered) {
		  mesh.chunkVisible("BlackBox", true);
		  mesh.chunkVisible("zReticle", true);
		  mesh.chunkVisible("zScaleCurve", true);
		  mesh.chunkVisible("zScaleM", true);
		  mesh.chunkVisible("zScaleKM", true);
		  mesh.chunkVisible("zScaleKMH", true);
		}else {
		  mesh.chunkVisible("BlackBox", false);
		  mesh.chunkVisible("zReticle", false);
		  mesh.chunkVisible("zScaleCurve", false);
		  mesh.chunkVisible("zScaleM", false);
		  mesh.chunkVisible("zScaleKM", false);
		  mesh.chunkVisible("zScaleKMH", false);
		}
	}
И в класс самолета добавить если нет:

Код:
	public float fSightCurAltitude = 300.0f; // 300 - 5000 m
	public float fSightCurSpeed = 50.0f; // 50 - 350 km/h

	private Point3d endPoint = new Point3d();
	private Point3d hitPoint = new Point3d();
	private Vector3d vTemp = new Vector3d();
	private Orient oTemp = new Orient();

	public boolean typeBomberToggleAutomation()
	{
		return false;
	}

	public void typeBomberAdjDistanceReset()
	{
	}

	public void typeBomberAdjDistancePlus()
	{
	}

	public void typeBomberAdjDistanceMinus()
	{
	}

	public void typeBomberAdjSideslipReset()
	{
	}

	public void typeBomberAdjSideslipPlus()
	{
	}

	public void typeBomberAdjSideslipMinus()
	{
	}

	public void typeBomberAdjAltitudeReset()
	{
		if (!World.cur().diffCur.RealisticBombSights)
			return;
		fSightCurAltitude = 300.0f;
	}

	public void typeBomberAdjAltitudePlus()
	{
		if (!World.cur().diffCur.RealisticBombSights)
			return;
		fSightCurAltitude += 50.0f;
		if (fSightCurAltitude > 5000.0f)
		{
			fSightCurAltitude = 5000.0f;
		}
		HUD.log(AircraftHotKeys.hudLogWeaponId, "BombsightAltitude",
				new Object[]
				{ new Integer((int) fSightCurAltitude) });
	}

	public void typeBomberAdjAltitudeMinus()
	{
		if (!World.cur().diffCur.RealisticBombSights)
			return;
		fSightCurAltitude -= 50.0f;
		if (fSightCurAltitude < 300.0f)
		{
			fSightCurAltitude = 300.0f;
		}
		HUD.log(AircraftHotKeys.hudLogWeaponId, "BombsightAltitude",
				new Object[]
				{ new Integer((int) fSightCurAltitude) });
	}

	public void typeBomberAdjSpeedReset()
	{
		if (!World.cur().diffCur.RealisticBombSights)
			return;
		fSightCurSpeed = 50.0f;
	}

	public void typeBomberAdjSpeedPlus()
	{
		if (!World.cur().diffCur.RealisticBombSights)
			return;
		fSightCurSpeed += 5.0f;
		if (fSightCurSpeed > 350.0f)
		{
			fSightCurSpeed = 350.0f;
		}
		HUD.log(AircraftHotKeys.hudLogWeaponId, "BombsightSpeed", new Object[]
		{ new Integer((int) fSightCurSpeed) });
	}

	public void typeBomberAdjSpeedMinus()
	{
		if (!World.cur().diffCur.RealisticBombSights)
			return;
		fSightCurSpeed -= 5.0f;
		if (fSightCurSpeed < 50.0f)
		{
			fSightCurSpeed = 50.0f;
		}
		HUD.log(AircraftHotKeys.hudLogWeaponId, "BombsightSpeed", new Object[]
		{ new Integer((int) fSightCurSpeed) });
	}

	public void typeBomberUpdate(float dt)
	{
		if (!World.cur().diffCur.RealisticBombSights){

			fSightCurAltitude = (float)World.getPlayerAircraft().FM.getAltitude()-(float)hitPoint.z;
			fSightCurSpeed = (float)World.getPlayerAircraft().getSpeed(null)*3.6f;
			double bombDist = getBombDist(fSightCurAltitude,
					(double) (fSightCurSpeed / 3.6000000000000001D));

			//measure the exact ground height at the point where the bombsight is pointing.
			if (FM.isTick(4, 0))
			{
				oTemp.setYaw(FM.Or.getYaw());
				oTemp.setRoll(0);
				oTemp.setPitch(30f);
				vTemp.set(1,0,0);
				oTemp.transform(vTemp);
				vTemp.scale(100000);
				endPoint.set(this.pos.getAbsPoint());
				endPoint.add(vTemp);
				Landscape.rayHitHQ(this.pos.getAbsPoint(), endPoint, hitPoint);
			}
		}
	}

	public void typeBomberReplicateToNet(NetMsgGuaranted out)
			throws IOException
	{
		if (!World.cur().diffCur.RealisticBombSights)
			return;
		out.writeFloat(fSightCurAltitude);
		out.writeFloat(fSightCurSpeed);
	}

	public void typeBomberReplicateFromNet(NetMsgInput in) throws IOException
	{
		if (!World.cur().diffCur.RealisticBombSights)
			return;
		fSightCurAltitude = in.readFloat();
		fSightCurSpeed = in.readFloat();
	}
  }
Весь код под версию 4.13, для 4.12 возможно потребуется поправить.
__________________
Их восемь — нас двое. Расклад перед боем
Не наш, но мы будем играть!
Серёжа! Держись, нам не светит с тобою,
Но козыри надо равнять.

© В. Высоцкий
__________________

Asura вне форума   Ответить с цитированием