Talk:Flying

Revision as of 00:55, 27 December 2011 by imported>8asrun6aer (→‎Bugs)

Credits: although I rewrote this script using different flight methods, effects and script procedural flow and used a new solution to clipping/ghosting, I based the concept off of the flying script packaged with the "A Chingari and Ismelda Demon Race:Demon Race v3-0-3" mod found on TES Nexus (the mod contains adult content).

I set up this 'Flying' page to document up-to-date natural and efficient flying methods which the entire modding community can reuse.

8asrun6aer 21:27, 23 December 2011 (EST);

This is fantastic. Just how similar is it to the other mod? If you're borrowing code, it's appropriate to give them credit in the main page.
Dragoon Wraith TALK 09:22, 24 December 2011 (EST)
At this point, it's pretty dissimilar. I took out most of the old script, condensed everything into a single script, added in the optional damage to fatigue part, added in the control bindings on load part, changed the method of flight to use velocity rather than setpos, adjusted for gravity using a method found by another user on this forum, made it more clear how pitch/heading were used and calculations are a bit different, and used different dynamics for more realistic climbing vs falling speeds, and others. But since I used their script as the initial foundation, I think they're due credit.
8asrun6aer 12:08, 24 December 2011 (EST);
Fair enough; I've removed the direct link, though, as I'm pretty sure we cannot link to adult content from here. Mentioning it by name should be sufficient for anyone who wants to find it, and certainly is enough for the sake of giving credit.
I spoke with Ismelda herself, by the way, and she liked the script.
Dragoon Wraith TALK 12:46, 24 December 2011 (EST)
Awesome. They should be able to add this script as a small patch if they want without affecting anything. The only issue that I know of would be the flight activation key and the config script they use to change that in-game, which I took out in the example script. Plus since it declares all new variables and gets rid of the start block, I have a feeling it won't work out-of-the-box in already existing saved games. Maybe make a new quest which adds the ability on the next game load...? Their wing animations still work fine.
8asrun6aer 13:16, 24 December 2011 (EST);

Physics, Trig and Flight Formulas

To be honest, when it comes to physics or trig, I have no idea what I'm doing. So, I fell back to basic math. Case in point: the `cstmZPitchModifyer` variable. This is basically a percentage of maximum up/down angle the player is facing (see: GetAngle x) applied to the ascent/decent speed (Z velocity).

For examples: looking straight up is -89 degrees (stored as 1 in `cstmZPitchModifyer`), straight ahead is 0 degrees (stored as 0.0), downward-most facing is 89 degrees (stored as -1.0), and looking down at 20 degrees is stored as roughly -0.22. So say you're moving forward while facing downward at 20 degrees while going 600 units per second, the descent (Z velocity) speed roughly figures to -20% of 600, or roughly translating in-game to descending at 120 units per second. I'm sure hacking it this way violates several laws of real-life physics, and would probably make any 1st-year aerospace engineering student face-palm, but the in-game effect looks passable.

Second - notice I modified `cstmZPitchModifyer` again based on if the player is facing up (0.7) vs down (2.0). This fakes the fact that it would take more energy and thus be slower to ascend vs descend. This is just a bit of candy-coating with a bit more realism, and can be removed if desired.

So ultimately, I think the equations could be written better. If anyone has ideas for more efficient formulas that can give better physics effects in-game, feel free to chime in or edit the code.

8asrun6aer 00:31, 27 December 2011 (EST);

Bugs

  1. At line ~194, the formula used to counteract local gravity can be found in the GetLocalGravity page. This might not be exact as the player still loses elevation very slowly if hovering in place. 8asrun6aer 00:55, 27 December 2011 (EST);
  2. Sometimes, activating flying only causes the player to rise 20 or so feet and then fall. Click the activate key a few more times to really activate flying. The exact location of this bug in this script is not yet known, but likely somewhere in the initial flight activation check area (line ~69). 8asrun6aer 00:55, 27 December 2011 (EST);
Return to "Flying" page.