How to mad speedomteter? any scripts?

this is pretty simple to do
it uses the linervelocity to set a frame in an animation.

here is an example.
overlay2.blend (2.7 MB)

i did not see you wanted the speed as text, so here is a modified version
speed-overlay.blend (2.7 MB)

1 Like

i will check this later i need rest form games thanks for try help

hi bro i try made as in you example but problem that circle speedometer dont show in my game scene

and if i add to camera add overlay scnene it show but speed not updated text not move and dont show the speed

maybe i do something wrong

did you download the blend above and test it ??.

yes belnd file work

but i try append overlay scene to my game from you blend file and connect speedometer and i cant understand how connect and made the same i did and connect all is in you example but it was not work

if you wish i can made video how i try connect it you will tell me what i forget or not did to it work

here video how try apply it it not work watch i know need do somethink i dont know

did you name things the same as in the script (it matters)

YES i name same

when i try to see the video i get this

sorry for that i upload video now you can download and watch https://yadi.sk/i/DD7_HxWhKfT9og

you must have overlook the logic brick a have on the lamp

and a sidenote, look in the console for any errors

ok i will try thanks

hi bro thanks it working now big thanks for help

watch bro my game much better with speedometer it not perfect speed sometime goes - minus but somethink https://youtu.be/AOCrWfLHxD0

this should fix the negative speed

import bge
import time
import copy

scenes = bge.logic.getSceneList()
dict = bge.logic.globalDict

player = None

def speed(pos):
    if "pos" in dict:
        speed = 0
        
        if "time" in dict:
            t = (dict["pos"] - pos ).length
            speed = t / (time.time() - dict["time"])
        
        dict["time"] = time.time()
        
        return int(speed)
    
    return 0
    
for scene in scenes:
    if "Scene" in scene.name:
        player = scene.objects["player"]
        
    if "overlay" in scene.name:
        if player:
            pos = copy.copy(player.worldPosition)
            
            speed = speed(pos)
            
            needle = scene.objects["speed"]
            needle["speed"] = speed
            
            speed_txt = "{:>03}".format(speed)
            scene.objects["Text"]["Text"] = speed_txt
            
            dict["pos"] = pos
1 Like

is this not doing the same thing as

player.worldPosition.copy()

but without the need for the copy module?

it runs the same so i dont realy care.

cheers bro it fixed you script work no negative speed now thank you so much for help