Flying: Difference between revisions

Jump to navigation Jump to search
cleanup
(fix misinformation)
(cleanup)
Line 56: Line 56:
Notice that there is no code handling air steps for ledge grabbing or hanging on a ceiling, so such transitions are impossible.
Notice that there is no code handling air steps for ledge grabbing or hanging on a ceiling, so such transitions are impossible.
===update_flying===
===update_flying===
Casually, tilt the joystick left to move left, right to move right, up to move down, down to move up.
Casually, tilt the joystick left to move left, right to move right, up to move down, down to move up. '''TODO:''' I heard moving down then up can be faster then just the direct line. Explain big picture movements, what happens in a practical example.


I am too lazy to describe the exact details of <code>update_flying</code>, so here is the code
Beyond this, the pseudocode is provided but probably isn't as useful as the <code>update_flying</code> code itself:
# Joystick inputs affect (pitch,yaw) velocity.
# Yaw velocity affects yaw, roll, and forward velocity.
# Pitch affects forward velocity.
# Forward velocity becomes at least 0
# Forward velocity affects pitch (see above table)
# Pitch velocity affects pitch.
# Pitch is clamped to be inside [-0x2AAA, 0x2AAA]
# x,y,z velocity is more or less directly exactly correspondent to forward velocity, pitch, and yaw.
# xz sliding velocity updated to correspond
<syntaxhighlight lang="c">
<syntaxhighlight lang="c">
void update_flying(struct MarioState *m) {
void update_flying(struct MarioState *m) {
Line 106: Line 115:
* Pitch has a minimum and maximum and cannot overflow with standard speeds.
* Pitch has a minimum and maximum and cannot overflow with standard speeds.
* '''More below the tables'''
* '''More below the tables'''
* '''TODO:''' I heard moving down then up can be faster then just the direct line. Explain big picture movements, what happens in a practical example.
{| class="wikitable"
{| class="wikitable"
|+forwardVel's affect on pitch
|+forwardVel's affect on pitch
Line 151: Line 159:
|6
|6
|}
|}
*'''TODO:''' I heard moving down then up can be faster then just the direct line. Explain big picture movements, what happens in a practical example.
Although I posted the code instead of the detailed psuedocode, here's some less detailed psuedocode anyways:
Although I was too lazy, I typed a less detailed pseudocode anyways:
# Joystick inputs affect (pitch,yaw) velocity.
# Yaw velocity affects yaw, roll, and forward velocity.
# Pitch affects forward velocity.
# Forward velocity becomes at least 0
# Forward velocity affects pitch (see above table)
# Pitch velocity affects pitch.
# Pitch is clamped to be inside [-0x2AAA, 0x2AAA]
# x,y,z velocity is more or less directly exactly correspondent to forward velocity, pitch, and yaw.
# xz sliding velocity updated to correspond
<hr>
<hr>
Here are some tables summarizing the <code>approach_s32</code>, <code>update_flying_pitch</code>, and <code>update_flying_yaw</code> functions.
Here are some tables summarizing the <code>approach_s32</code>, <code>update_flying_pitch</code>, and <code>update_flying_yaw</code> functions.
Line 224: Line 219:
#Add yaw velocity to yaw
#Add yaw velocity to yaw
# Set roll to yaw times negative twenty (-20)
# Set roll to yaw times negative twenty (-20)
'''Note that turning left = positive yaw''' (up = positive pitch).<ref>https://youtu.be/TQt8MCsniQI</ref>
'''Note that turning left = positive yaw''' (up = positive pitch).<ref>https://youtu.be/TQt8MCsniQI</ref><syntaxhighlight lang="c">
 
*
<syntaxhighlight lang="c">
/**
/**
  * Return the value 'current' after it tries to approach target, going up at
  * Return the value 'current' after it tries to approach target, going up at
246

edits

Navigation menu