246
edits
Icecream17 (talk | contribs) (make it screenshottable) |
Icecream17 (talk | contribs) (fix misinformation) |
||
Line 98: | Line 98: | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Key takeaways: | '''Key takeaways''': | ||
* Pitching to move up happens faster with | * Pitching to move up happens faster with higher forward velocity. | ||
** The difference between 4 and 5 speed, and 16 and 17 speed is especially large. | |||
* At the same time, forward velocity is based on pitch. (But it is also based on:) | |||
** There is a base 0.1 forwardVel speed loss | |||
** There is anywhere from 0 to 0.5 further speed loss - more speed is lost the higher the yaw velocity is (ie '''the more Mario turns'''). | |||
* Pitch has a minimum and maximum and cannot overflow with standard speeds. | |||
* '''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 | |+forwardVel's affect on pitch | ||
|'''<=4''' | |'''<=4''' | ||
|5 | |5 | ||
Line 123: | Line 130: | ||
|33 | |33 | ||
|- | |- | ||
| - | | -1024 | ||
| -270 | | -270 | ||
| -260 | | -260 | ||
Line 144: | Line 151: | ||
|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. | |||
* '''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. | # Joystick inputs affect (pitch,yaw) velocity. | ||
# Yaw velocity affects yaw, roll, and forward velocity. | # Yaw velocity affects yaw, roll, and forward velocity. | ||
# Pitch affects forward velocity. | # Pitch affects forward velocity. | ||
# Forward velocity affects pitch | # Forward velocity becomes at least 0 | ||
# Forward velocity affects pitch (see above table) | |||
# Pitch velocity affects pitch. | # 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. | # 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 165: | Line 176: | ||
|negative pitch velocity | |negative pitch velocity | ||
|add 64 vel, cap at 32 | |add 64 vel, cap at 32 | ||
| approach (at most | | approach (at most 64 up or 32 down) | ||
|approach 0 (by at most | |approach 0 (by at most 64) | ||
|- | |- | ||
|positive pitch velocity | |positive pitch velocity | ||
| approach (at most | | approach (at most 32 up or 64 down) | ||
|subtract 64 vel, cap at -32 | |subtract 64 vel, cap at -32 | ||
|approach 0 (by at most | |approach 0 (by at most 64) | ||
|- | |- | ||
|zero pitch velocity | |zero pitch velocity | ||
| approach (at most | | approach (at most 32 up or 64 down) | ||
| approach (at most | | approach (at most 64 up or 32 down) | ||
| approach 0 (by at most | | approach 0 (by at most 64) | ||
|} | |} | ||
{| class="wikitable" | {| class="wikitable" | ||
Line 187: | Line 198: | ||
|negative yaw velocity | |negative yaw velocity | ||
| add 64 vel, cap at 16 | | add 64 vel, cap at 16 | ||
|approach (at most | |approach (at most 32 up or 16 down) | ||
|approach 0 (by at most | |approach 0 (by at most 64) | ||
|- | |- | ||
|positive yaw velocity | |positive yaw velocity | ||
| approach (at most | | approach (at most 16 up or 32 down) | ||
| subtract 64 vel, cap at -16 | | subtract 64 vel, cap at -16 | ||
|approach 0 (by at most | |approach 0 (by at most 64) | ||
|- | |- | ||
|zero yaw velocity | |zero yaw velocity | ||
|approach (at most | |approach (at most 16 up or 32 down) | ||
|approach (at most | |approach (at most 32 up or 16 down) | ||
|approach 0 (by at most | |approach 0 (by at most 64) | ||
|} | |} | ||
'''Key takeaways''': | |||
# Many joystick positions are equivalent. | |||
# One cannot change velocity by more than 64 (ignoring the effects of speed) | |||
# Holding joystick x=0 or y=0 will approach the corresponding 0 by at most 64. | |||
#* In contrast, holding the opposite direction changes the angle by 32 (yaw) or 64 (pitch), unconditionally | |||
#* In further contrast, holding less of the same direction changes the angle by 32 (yaw) or 64 (pitch) | |||
#* In even furthest contrast, holding more of the same direction changes the angle by 16 (yaw) or 32 (pitch) | |||
#* So it might be faster to say, modify pitch:as such: -56 to -4 to 60 instead of -56 to 8 to 40. Notice the slightly under zero instead of slightly over zero. | |||
After that, update_flying_yaw does: | After that, update_flying_yaw does: | ||
#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"> |
edits