31 #include <fmt/format.h>
48 Ogre::String
const& propfoilname,
138 sprintf(dename,
"%s-smoke", propname);
145 smokePS->setCastShadows(
false);
179 ParticleEmitter* emit =
smokePS->getEmitter(0);
181 emit->setDirection(dir);
187 emit->setEnabled(
true);
188 emit->setColour(ColourValue(0.0, 0.0, 0.0, 0.03 +
throtle * 0.05));
189 emit->setTimeToLive((0.03 +
throtle * 0.05) / 0.1);
193 emit->setEnabled(
false);
198 emit->setDirection(Vector3(0, 1, 0));
199 emit->setParticleVelocity(5, 9);
200 emit->setEnabled(
true);
201 emit->setColour(ColourValue(0.0, 0.0, 0.0, 0.1));
202 emit->setTimeToLive(0.1 / 0.1);
206 #ifdef USE_ANGELSCRIPT
228 float sea_level_pressure = 101325;
230 float airpressure = sea_level_pressure * pow(1.0 - 0.0065 * altitude / 288.15, 5.24947);
244 Vector3 avg = Vector3::ZERO;
255 float enginepower = 0;
256 float warmupfm_actor = 1.0;
260 if (warmupfm_actor >= 1.0)
263 float revpenalty = 1.0;
267 enginepower = (0.0575 +
throtle * revpenalty * 0.9425) *
fullpower * warmupfm_actor;
269 float enginecouple = 0.0;
271 enginecouple = 9549.3 * enginepower /
rpm;
273 enginecouple = 9549.3 * enginepower / 10.0;
279 Plane ppl = Plane(along, 0);
281 Vector3 cdir = orth.crossProduct(along);
311 if (!(dpitch < 0 &&
pitch < 0) && !(dpitch > 0 &&
pitch > 45))
312 pitch += dpitch * dt;
344 Vector3 totaltipforce = Vector3::ZERO;
349 Vector3 refchordv = -
axis.crossProduct(spanv);
351 Vector3 tipf = -refchordv;
352 totaltipforce += (tipforce -
rpm / 10.0) * tipf;
354 for (
int j = 0; j < 5; j++)
357 float proport = ((float)j + 0.5) / 6.0;
360 float wspeed = wind.length();
362 Vector3 liftv = spanv.crossProduct(-wind);
365 Vector3 chordv = Quaternion(Degree(
pitch +
twistmap[j] - 7.0), spanv) * refchordv;
367 Vector3 normv = chordv.crossProduct(spanv);
369 Vector3 pwind = Plane(Vector3::ZERO, normv, chordv).projectVector(wind);
372 chordv.getRotationTo(pwind).ToAngleAxis(daoa, dumb);
373 float aoa = daoa.valueDegrees();
374 float raoa = daoa.valueRadians();
375 if (dumb.dotProduct(spanv) > 0)
390 float lift = cz * 0.5 *
airdensity * wspeed * wspeed * s;
391 eforce += lift * liftv;
392 totthrust += eforce.dotProduct(
axis);
396 totaltipforce += eforce * (1.0 - proport);
398 tottorque += tipf.dotProduct(totaltipforce) *
radius;
400 float correctfm_actor = 0;
403 if (correctfm_actor > 1000.0)
404 correctfm_actor = 1000.0;
405 if (correctfm_actor < -1000.0)
406 correctfm_actor = -1000.0;
428 totthrust = -totthrust;