Objects that watch for Mouse Over
by suddysud aka mrclean · in Torque Game Engine · 02/20/2006 (12:01 am) · 5 replies
Hi
I'm trying to get MOUSEOVER on 3D objects to reveal information about the object.
Here is a simple Example.
With the FPS example, the character is KORK. Well I don't want to see KORK's Name and Health Status unless I mouse over him. How can I control that ? can it be done with Script ? Sadly i'm not a C++ coder although I'm willing to learn but if it can be done in script I'll prefer that option.
Another little variation on this theme. is that when a person mouses over an object I want it to present a little 2D graphic over that item.
Thanks in advance
stev
I'm trying to get MOUSEOVER on 3D objects to reveal information about the object.
Here is a simple Example.
With the FPS example, the character is KORK. Well I don't want to see KORK's Name and Health Status unless I mouse over him. How can I control that ? can it be done with Script ? Sadly i'm not a C++ coder although I'm willing to learn but if it can be done in script I'll prefer that option.
Another little variation on this theme. is that when a person mouses over an object I want it to present a little 2D graphic over that item.
Thanks in advance
stev
#2
03/01/2006 (12:36 pm)
In the editor where it shows XYZ when you move mouse over stuff, there is some good code for this. I'm sure you can find what I'm talking about.
#3
03/01/2006 (4:32 pm)
This makes me wonder though.. i never really found out how that name and health bar thing works. Anybody care to explain? Is this handled in the script? If so.. what file? (i'm not talking about the gui health bar, but the one that displays when you aim at the orc)
#4
Pretty much all of the action takes place in the C++ code, not script.
03/09/2006 (7:23 pm)
Well its 2 different things - the name part is one gui object GuiShapeNameHud, and the health bar is part of the guiCrossHairHud. Pretty much all of the action takes place in the C++ code, not script.
#5
the updated object selection resource is exactly what you want to look at.
there's comments in there on how to do it entirely client-side, which is probably what you want.
03/09/2006 (7:52 pm)
Expanding on what stefan said,the updated object selection resource is exactly what you want to look at.
there's comments in there on how to do it entirely client-side, which is probably what you want.
Torque Owner Stefan Lundmark
2. Return the objects ID, and position.
3. Draw your graphic and any information by converting the 3d position data to 2d coordinates.
Except number 2, all this is easily done in script. I suggest you search the forums, in particular for Dreamers tutorial on object selection in script.
There's also some comments on how to do it in the source code of TGE, guiCrossHair.