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)