Created
December 30, 2016 20:24
-
-
Save mcongrove/78d206c8581a6dd2584bf164144c42b3 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
defineProperty("viewX", globalPropertyf("sim/graphics/view/view_x")) | |
defineProperty("viewY", globalPropertyf("sim/graphics/view/view_y")) | |
defineProperty("viewZ", globalPropertyf("sim/graphics/view/view_z")) | |
defineProperty("acfX", globalPropertyf("sim/flightmodel/position/local_x")) | |
defineProperty("acfY", globalPropertyf("sim/flightmodel/position/local_y")) | |
defineProperty("acfZ", globalPropertyf("sim/flightmodel/position/local_z")) | |
function cameraDistance() | |
local cX = (math.abs(get(viewX)) - math.abs(get(acfX))) | |
local cY = (math.abs(get(viewY)) - math.abs(get(acfY))) | |
local cZ = (math.abs(get(viewZ)) - math.abs(get(acfZ))) | |
local cDist = math.sqrt((cX)^2 + (cY)^2 + (cZ)^2) | |
return cDist | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment