Could anyone tell me what to modify in the FPS sample from Blender 2.43 game demos (graphics), in a way to display the name of the object when the crosshair aims at it?
You could put a text plane above the object(s) and parent the plane to the object.Then, since you need a “Text” property you could add this script to the object:
own = GameLogic.getCurrentController().getOwner()
#--Get the children of the object (one should be the text plane)
children = own.getChildren()
#--Go through the children to find the text plane and store it in text
for child in children:
if hasattr(child, "Text"):
text = child
"""
You'll have to figure out how to get this script to fire when you want it too.
I'd look into using the mouse over sensor. I don't know too terribly much about this,
so you're on your own. Replace displayName with what you're using.
"""
if displayName:
text.Text = own.name
else:
text.Text = ""
Thank you for your reply. I will look into it immediately. Thank you for showing me the direction where to look. I will look into mouse-over sensor as well.