Gamestudio Links
Zorro Links
Newest Posts
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (BrainSailor, AndrewAMD), 1,662 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19058 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Mouse hover #126920
04/28/07 05:30
04/28/07 05:30
Joined: Jul 2006
Posts: 91
Florida, USA
Knuckles Offline OP
Junior Member
Knuckles  Offline 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
M
MrCode Offline
User
MrCode  Offline
User
M

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.


Code:
void main()
{
    cout << "I am MrCode,";
    cout << "hear me roar!";
    system("PAUSE");
}
Re: Mouse hover [Re: MrCode] #126922
04/28/07 06:11
04/28/07 06:11
Joined: Jul 2006
Posts: 91
Florida, USA
Knuckles Offline OP
Junior Member
Knuckles  Offline OP
Junior Member

Joined: Jul 2006
Posts: 91
Florida, USA
Well looking through all the mouse() functions, I didn't see any that talks about space coordinates for the mouse. Am I not supposed to use the mouse() functions at all?

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 Offline
Expert
xXxGuitar511  Offline
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: xXxGuitar511] #126924
04/28/07 06:42
04/28/07 06:42
Joined: Jul 2006
Posts: 91
Florida, USA
Knuckles Offline OP
Junior Member
Knuckles  Offline OP
Junior Member

Joined: Jul 2006
Posts: 91
Florida, USA
thank you! So is the vec_for_screen function generally used for converting the mouse_pos coordinates like this?

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 Offline
Expert
xXxGuitar511  Offline
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: xXxGuitar511] #126926
04/28/07 06:43
04/28/07 06:43
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck

Re: Mouse hover [Re: Xarthor] #126927
04/28/07 09:54
04/28/07 09:54
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline
User
tompo  Offline
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
good idea... use my.enable_touch and event_touch function.


Never say never.
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 Offline
Senior Member
Dj_Pint  Offline
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 Offline OP
Junior Member
Knuckles  Offline 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;
}



Page 1 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1