Make a Head Up Display for Flight Sim Game (question)

Greetings everyone

hmm i’m now continuing my progress in making my own Flight Sim Game, after done with control scheme (mouse based) ,i decided to make at least a simple but workable Head Up Displays for my flight sim-game , hmm it should displyas heading (NESW) ,altitude and Speed of my Aircraft
However i kinda blank of what to do to make those,so can anyone help me

any tips and solutions is appreciated

You’ll need to use Python.

You can get the velocity of an object with object.getVelocity(), or of course, you can calculate the speed yourself, with object.getPosition().

You could get the altitude with a ray sensor pointing downwards from your aircraft.

however it seems i need more help in setting those, especially about how to display obtained data from those functions (like objectgetvelocity) into numbers

object.getVelocity() returns a list: [vx, vy, vz]. I can’t remember if the velocity is in global coordinates or local coordinates, but it should be fairly simple to set up a test to print out those values and see. If its global, just use some simple math to add the vectors (pythag).

To display the numbers add a plane with dynamic text then use a script to assign the value to the text property. Example

import GameLogic 
cont = GameLogic.getCurrentController()
own = cont.getOwner()
list = GameLogic.getCurrentScene().getObjectList()

vel = own.getVelocity()
#assuming velocity is local, and your plane moves forward in the y direction
list["OBTextObj"].Text = vel[1]

I hope that helps! I think I have a link to some resource about just about everything I said if you click on “resources” in my sig.