Created
August 12, 2024 13:55
-
-
Save numberlesstim/19f6bdb4dd3063de4acb0b70e6b37d63 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//gist 19f6bdb4dd3063de4acb0b70e6b37d63 | |
function matchVelAtNode { | |
parameter nodeX is nextnode. | |
parameter tarvel is "none". | |
set tx to nodeX:time. | |
set nodeX:prograde to 0. | |
set nodeX:radialout to 0. | |
set nodeX:normal to 0. | |
wait 0.1. | |
set nodepro to velocityat(ship, tx):orbit:normalized. | |
set noderad to vxcl(nodepro, (positionat(ship, tx) - body:position)):normalized. | |
set nodenorm to vcrs(nodepro, noderad):normalized. | |
set tarvel to choose tarvel - velocityat(ship, tx):orbit if tarvel:istype("vector") else velocityat(target, tx):orbit - velocityat(ship, tx):orbit. | |
set pro to vdot(nodepro, tarvel). | |
set rad to vdot(noderad, tarvel). | |
set norm to vdot(nodenorm, tarvel). | |
set nodeX:prograde to pro. | |
set nodeX:radialout to rad. | |
set nodeX:normal to norm. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment