31 #include <fmt/format.h>
48 Ogre::String
const& propfoilname,
138 sprintf(dename,
"%s-smoke", propname);
145 smokePS->setCastShadows(
false);
180 ParticleEmitter* emit =
smokePS->getEmitter(0);
182 emit->setDirection(dir);
188 emit->setEnabled(
true);
189 emit->setColour(ColourValue(0.0, 0.0, 0.0, 0.03 +
throtle * 0.05));
190 emit->setTimeToLive((0.03 +
throtle * 0.05) / 0.1);
194 emit->setEnabled(
false);
199 emit->setDirection(Vector3(0, 1, 0));
200 emit->setParticleVelocity(5, 9);
201 emit->setEnabled(
true);
202 emit->setColour(ColourValue(0.0, 0.0, 0.0, 0.1));
203 emit->setTimeToLive(0.1 / 0.1);
207 #ifdef USE_ANGELSCRIPT
229 float sea_level_pressure = 101325;
231 float airpressure = sea_level_pressure * pow(1.0 - 0.0065 * altitude / 288.15, 5.24947);
245 Vector3 avg = Vector3::ZERO;
256 float enginepower = 0;
257 float warmupfm_actor = 1.0;
261 if (warmupfm_actor >= 1.0)
264 float revpenalty = 1.0;
268 enginepower = (0.0575 +
throtle * revpenalty * 0.9425) *
fullpower * warmupfm_actor;
270 float enginecouple = 0.0;
272 enginecouple = 9549.3 * enginepower /
rpm;
274 enginecouple = 9549.3 * enginepower / 10.0;
280 Plane ppl = Plane(along, 0);
282 Vector3 cdir = orth.crossProduct(along);
312 if (!(dpitch < 0 &&
pitch < 0) && !(dpitch > 0 &&
pitch > 45))
313 pitch += dpitch * dt;
345 Vector3 totaltipforce = Vector3::ZERO;
350 Vector3 refchordv = -
axis.crossProduct(spanv);
352 Vector3 tipf = -refchordv;
353 totaltipforce += (tipforce -
rpm / 10.0) * tipf;
355 for (
int j = 0; j < 5; j++)
358 float proport = ((float)j + 0.5) / 6.0;
361 float wspeed = wind.length();
363 Vector3 liftv = spanv.crossProduct(-wind);
366 Vector3 chordv = Quaternion(Degree(
pitch +
twistmap[j] - 7.0), spanv) * refchordv;
368 Vector3 normv = chordv.crossProduct(spanv);
370 Vector3 pwind = Plane(Vector3::ZERO, normv, chordv).projectVector(wind);
373 chordv.getRotationTo(pwind).ToAngleAxis(daoa, dumb);
374 float aoa = daoa.valueDegrees();
375 float raoa = daoa.valueRadians();
376 if (dumb.dotProduct(spanv) > 0)
391 float lift = cz * 0.5 *
airdensity * wspeed * wspeed * s;
392 eforce += lift * liftv;
393 totthrust += eforce.dotProduct(
axis);
397 totaltipforce += eforce * (1.0 - proport);
399 tottorque += tipf.dotProduct(totaltipforce) *
radius;
401 float correctfm_actor = 0;
404 if (correctfm_actor > 1000.0)
405 correctfm_actor = 1000.0;
406 if (correctfm_actor < -1000.0)
407 correctfm_actor = -1000.0;
429 totthrust = -totthrust;