IxionAlpha Posted October 3, 2020 Share Posted October 3, 2020 Hi, I am currently trying to display the ship velocity on one of my cockpit screens. It works just fine for a lot of stats like gravity or atmosphere density ant other. However, it does not work for the velocity and for the acceleration. What am I doing wrong? Here the code: local atmoDensity = (math.floor((unit.getAtmosphereDensity()*1000)))/1000 --export local altitude = math.floor(core.getAltitude()) --export local gForce = (math.floor((core.g()*1000)))/1000 --export local shipVelocity = vec3(core.getVelocity()) --export local shipAcceleration = vec3(core.getAcceleration()) --export local pitch = (math.floor((gyro.getPitch()*1000)))/1000 --export local yaw = (math.floor((gyro.getYaw()*1000)))/1000 --export local roll = (math.floor((gyro.getRoll()*1000)))/1000 --export html= [[ <table style=" margin-top = 10px; margin-left = auto; margin-right = auto; width: 80%; font-size: 3em;"> <tr> <th>Atmosphere Density: </th> <th>Altitude</th> <th>g Force</th> </tr> <tr> <th>]] ..atmoDensity..[[</th> <th>]]..altitude..[[</th> <th>]]..gForce..[[</th> </tr> </table> ]] leftScreen.setHTML(html) html2= [[ <table style=" margin-top = 10px; margin-left = auto; margin-right = auto; width: 80%; font-size: 3em;"> <tr> <th>Pitch: </th> <th>Yaw</th> <th>Roll</th> </tr> <tr> <th>]]..pitch..[[</th> <th>]]..yaw..[[</th> <th>]]..roll..[[</th> </tr> <tr> <th>Acceleration </th> <th>Velocity</th> </tr> <tr> <th>]]..shipAcceleration..[[</th> <th>]]..shipVelocity..[[</th> </tr> </table> ]] frontScreen.setHTML(html2) Link to comment Share on other sites More sharing options...
Fizz Posted November 15, 2020 Share Posted November 15, 2020 vec3(core.getVelocity()):len() Link to comment Share on other sites More sharing options...
Musclethorpe Posted November 16, 2020 Share Posted November 16, 2020 The warp calculator displays velocity on screen. Link to comment Share on other sites More sharing options...
JesseCaine Posted November 17, 2020 Share Posted November 17, 2020 On 11/16/2020 at 8:27 AM, Musclethorpe said: The warp calculator displays velocity on screen. That's not what the OP is asking for. Why do programmer-types never answer question posed but, instead, answer with their own question? Very odd subspecies of human... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now