2 registered members (BrainSailor, AndrewAMD),
1,662
guests, and 6
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Mouse hover
#126920
04/28/07 05:30
04/28/07 05:30
|
Joined: Jul 2006
Posts: 91 Florida, USA
Knuckles
OP
Junior Member
|
OP
Junior Member
Joined: Jul 2006
Posts: 91
Florida, USA
|
Suppose I want to allow a model to do an animation when I hover the mouse cursor over it. Would I need to use the Panel function for models? or is that just for BMPs only? I did something along the lines of: Code:
if((mouse_pos.x == player.x) && (mouse_pos.y == player.y) && (mouse_pos.z == player.z)) //if the mouse coords are the same as the player model's { // do the player model's animation here }
but it didn't work. I did a panel check and noticed that the mouse_pos data is different from the player's. It uses the screen size to determine the position (ie: 800 x 600) instead of the 3D world size, whereas the player model uses the actual 3D world coords. Should I not be using mouse_pos then?
|
|
|
Re: Mouse hover
[Re: Knuckles]
#126921
04/28/07 05:58
04/28/07 05:58
|
Joined: Mar 2007
Posts: 677 0x00000USA
MrCode
User
|
User
Joined: Mar 2007
Posts: 677
0x00000USA
|
The mouse position is within screen coordinates. The model is in space coordinates. I don't know much else, but that might help.
void main()
{
cout << "I am MrCode,";
cout << "hear me roar!";
system("PAUSE");
}
|
|
|
Re: Mouse hover
[Re: Knuckles]
#126923
04/28/07 06:36
04/28/07 06:36
|
Joined: Mar 2006
Posts: 2,503 SC, United States
xXxGuitar511
Expert
|
Expert
Joined: Mar 2006
Posts: 2,503
SC, United States
|
temp.x = MOUSE_POS.x; temp.y = MOUSE_POS.y; temp.z = 200; vec_for_screen(temp, CAMERA ); EDIT: MY 1234th post, lol...
Last edited by xXxGuitar511; 04/28/07 06:44.
xXxGuitar511 - Programmer
|
|
|
Re: Mouse hover
[Re: Knuckles]
#126925
04/28/07 06:43
04/28/07 06:43
|
Joined: Mar 2006
Posts: 2,503 SC, United States
xXxGuitar511
Expert
|
Expert
Joined: Mar 2006
Posts: 2,503
SC, United States
|
It's used for converting screen coords to world coords... check out all of the screen() functions in the manual
xXxGuitar511 - Programmer
|
|
|
Re: Mouse hover
[Re: tompo]
#126928
04/30/07 17:26
04/30/07 17:26
|
Joined: Feb 2006
Posts: 302 Beienrode/NDS/GERMANY
Dj_Pint
Senior Member
|
Senior Member
Joined: Feb 2006
Posts: 302
Beienrode/NDS/GERMANY
|
think this is easier: if(mouse_ent == player)
if u want to see some stuff i made, go to youTube and search for djpint, not dj pint^^
|
|
|
Re: Mouse hover
[Re: Dj_Pint]
#126929
05/11/07 01:39
05/11/07 01:39
|
Joined: Jul 2006
Posts: 91 Florida, USA
Knuckles
OP
Junior Member
|
OP
Junior Member
Joined: Jul 2006
Posts: 91
Florida, USA
|
I'm still having problems with this. I'm not sure what I'm doing wrong. Basically, I want to be able to select stuff in a 3D environment. For example, if there's a tree in the distance, when the mouse cursor hovers over it then the tree will light up or words will come on the screen. A snippet of what I've done: Code:
text contact_text { font = standard_font; layer = 10; pos_x = 350; pos_y = 100; size_y = 70; offset_y = 0; flags = center_x, narrow, visible; }
string str1 = "The mouse is touching the tree. \n Testing the text now. \n testing the line breaks also! loading.....";
function mouse_test() {
temp.x = MOUSE_POS.x; temp.y = MOUSE_POS.y; temp.z = MOUSE_POS.Z; vec_for_screen(temp, camera);
if((temp.x == tree.x) && (temp.y == tree.y) && (temp.z == tree.z)) { contact_text.string = str1; }
|
|
|
|