Welcome Guest [Log In] [Register]
We hope you enjoy your visit.


You're currently viewing the Ultimate 3D Community as a guest. This means that you can only read posts, but can not create posts or topics by yourself. To be able to post you need to register. Then you can participate in the community active and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.

Join our community!

If you are already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
Mouse coordinates imprecise; very weird
Topic Started: Oct 13 2008, 07:43 PM (296 Views)
Eansis
Member Avatar
ghost
[ *  *  *  *  *  * ]
Well, I have this code to set the mouse pos to smoothly reach the center. But it seems if the mouse is in the top or left half of the screen the mouse stops at pixel 719! Display_get_width() is equal to 720! Global.mouse_x/y I think is bugged or something.

SetMousePos(display_get_width()/2+(global.mouse_x-display_get_width()/2)/2,display_get_height()/2+(global.mouse_y-display_get_height()/2)/2);

When I simply set it to instantly move the mouse to display_get_width/height/2 there are no problems. :o
Edited by Eansis, Oct 13 2008, 07:44 PM.
VOTE FOR BUDDY ROEMER HE'S A STRAIGHTFORWARD, DOWN TO EARTH AMERICAN GUY WHO ISN'T PART OF THE BIGBROTHER CONSPIRACY

Til'c
 
Things will not calm down Daniel Jackson. They will infact calm up.
Offline Profile Quote Post Goto Top
 
skarik
Member Avatar
kitten eating scum
[ *  *  *  *  *  * ]
Um, what?

U3d's thingy sets it to the center of the screen automatically unlike GM's.
Blog|EHS
Offline Profile Quote Post Goto Top
 
ashrat3000
Member Avatar
u3d raytracer
[ *  *  *  *  *  * ]
I bet it has something to do with your smoothing script.
So yeah, it would help if you post it.

그대를 사랑해


Offline Profile Quote Post Goto Top
 
Eansis
Member Avatar
ghost
[ *  *  *  *  *  * ]
ashrat3000
Oct 14 2008, 12:54 AM
I bet it has something to do with your smoothing script.
So yeah, it would help if you post it.

I bet it has something to do with you not reading my post. It would help if you read it. I Posted The Script.

So what's this about U3d automatically setting the mouse to screen center?
Edited by Eansis, Oct 14 2008, 03:02 AM.
VOTE FOR BUDDY ROEMER HE'S A STRAIGHTFORWARD, DOWN TO EARTH AMERICAN GUY WHO ISN'T PART OF THE BIGBROTHER CONSPIRACY

Til'c
 
Things will not calm down Daniel Jackson. They will infact calm up.
Offline Profile Quote Post Goto Top
 
skarik
Member Avatar
kitten eating scum
[ *  *  *  *  *  * ]
Code:
 
SetMousePos(display_get_width()/2,display_get_height()/2);


...

Code:
 
SetMousePos(window_get_x()+(window_get_width()/2),window_get_y()+(window_get_height()/2));


I'll write you a code.
Edited by skarik, Oct 14 2008, 03:04 AM.
Blog|EHS
Offline Profile Quote Post Goto Top
 
Eansis
Member Avatar
ghost
[ *  *  *  *  *  * ]
Window_get_x is like the same function as display_mouse_get_x()? But it works with Ultimate3d?
VOTE FOR BUDDY ROEMER HE'S A STRAIGHTFORWARD, DOWN TO EARTH AMERICAN GUY WHO ISN'T PART OF THE BIGBROTHER CONSPIRACY

Til'c
 
Things will not calm down Daniel Jackson. They will infact calm up.
Offline Profile Quote Post Goto Top
 
skarik
Member Avatar
kitten eating scum
[ *  *  *  *  *  * ]
Code:
 
m_target_x = display_get_width()/2;
m_target_y = display_get_height()/2;
m_final_x = (global.mouse_x-m_target_x)/2 + m_target_x;
m_final_y = (global.mouse_y-m_target_y)/2 + m_target_y;
SetMousePos(m_final_x,m_final_y);


Nice, I'm using this. Great idea man!
Blog|EHS
Offline Profile Quote Post Goto Top
 
Eansis
Member Avatar
ghost
[ *  *  *  *  *  * ]
skarik
Oct 14 2008, 03:08 AM
Code:
 
m_target_x = display_get_width()/2;
m_target_y = display_get_height()/2;
m_final_x = (global.mouse_x-m_target_x)/2 + m_target_x;
m_final_y = (global.mouse_y-m_target_y)/2 + m_target_y;
SetMousePos(m_final_x,m_final_y);


Nice, I'm using this. Great idea man!
Except it won't work. -__-
Edited by Eansis, Oct 14 2008, 03:11 AM.
VOTE FOR BUDDY ROEMER HE'S A STRAIGHTFORWARD, DOWN TO EARTH AMERICAN GUY WHO ISN'T PART OF THE BIGBROTHER CONSPIRACY

Til'c
 
Things will not calm down Daniel Jackson. They will infact calm up.
Offline Profile Quote Post Goto Top
 
skarik
Member Avatar
kitten eating scum
[ *  *  *  *  *  * ]
Works great here.
Code:
 

GetMousePos();
//Mousecontrol
rotx+=(global.mouse_y-display_get_height()/2)*mouse_speed;
if(rotx<-60){
rotx=-59;
}
if(rotx>60){
rotx=59;
}
roty+=(global.mouse_x-display_get_width()/2)*mouse_speed;
//SetMousePos(display_get_width()/2,display_get_height()/2);

m_target_x = display_get_width()/2;
m_target_y = display_get_height()/2;
m_final_x = (global.mouse_x-m_target_x)/3 + m_target_x;
m_final_y = (global.mouse_y-m_target_y)/3 + m_target_y;
SetMousePos(round(m_final_x),round(m_final_y));


Works good on all the screen sizes (yes I test quick.)
Edited by skarik, Oct 14 2008, 03:12 AM.
Blog|EHS
Offline Profile Quote Post Goto Top
 
Eansis
Member Avatar
ghost
[ *  *  *  *  *  * ]
skarik
Oct 14 2008, 03:11 AM
Works great here.
Code:
 

GetMousePos();
//Mousecontrol
rotx+=(global.mouse_y-display_get_height()/2)*mouse_speed;
if(rotx<-60){
rotx=-59;
}
if(rotx>60){
rotx=59;
}
roty+=(global.mouse_x-display_get_width()/2)*mouse_speed;
//SetMousePos(display_get_width()/2,display_get_height()/2);

m_target_x = display_get_width()/2;
m_target_y = display_get_height()/2;
m_final_x = (global.mouse_x-m_target_x)/3 + m_target_x;
m_final_y = (global.mouse_y-m_target_y)/3 + m_target_y;
SetMousePos(round(m_final_x),round(m_final_y));


Works good on all the screen sizes (yes I test quick.)
Set the mouse coordinates as a variable and you'll see its 1 pixel lopsided.
Edited by Eansis, Oct 14 2008, 03:13 AM.
VOTE FOR BUDDY ROEMER HE'S A STRAIGHTFORWARD, DOWN TO EARTH AMERICAN GUY WHO ISN'T PART OF THE BIGBROTHER CONSPIRACY

Til'c
 
Things will not calm down Daniel Jackson. They will infact calm up.
Offline Profile Quote Post Goto Top
 
Eansis
Member Avatar
ghost
[ *  *  *  *  *  * ]
And yeah using round is a cheap fix. Still wondering why the problem occurs, though.
VOTE FOR BUDDY ROEMER HE'S A STRAIGHTFORWARD, DOWN TO EARTH AMERICAN GUY WHO ISN'T PART OF THE BIGBROTHER CONSPIRACY

Til'c
 
Things will not calm down Daniel Jackson. They will infact calm up.
Offline Profile Quote Post Goto Top
 
skarik
Member Avatar
kitten eating scum
[ *  *  *  *  *  * ]
Eanbro
Oct 14 2008, 03:26 AM
Still wondering why the problem occurs, though.
Screen coordinates are only precise to the integer. XD
Blog|EHS
Offline Profile Quote Post Goto Top
 
Eansis
Member Avatar
ghost
[ *  *  *  *  *  * ]
skarik
Oct 14 2008, 03:36 AM
Eanbro
Oct 14 2008, 03:26 AM
Still wondering why the problem occurs, though.
Screen coordinates are only precise to the integer. XD
So the range -1 to 0 is imprecise?
VOTE FOR BUDDY ROEMER HE'S A STRAIGHTFORWARD, DOWN TO EARTH AMERICAN GUY WHO ISN'T PART OF THE BIGBROTHER CONSPIRACY

Til'c
 
Things will not calm down Daniel Jackson. They will infact calm up.
Offline Profile Quote Post Goto Top
 
skarik
Member Avatar
kitten eating scum
[ *  *  *  *  *  * ]
Screen coordinates are only precise to the unsigned integer in the range of your hardware's specifications. XD
Edited by skarik, Oct 14 2008, 04:38 AM.
Blog|EHS
Offline Profile Quote Post Goto Top
 
Eansis
Member Avatar
ghost
[ *  *  *  *  *  * ]
skarik
Oct 14 2008, 04:38 AM
Screen coordinates are only precise to the unsigned integer in the range of your hardware's specifications. XD
oh.
VOTE FOR BUDDY ROEMER HE'S A STRAIGHTFORWARD, DOWN TO EARTH AMERICAN GUY WHO ISN'T PART OF THE BIGBROTHER CONSPIRACY

Til'c
 
Things will not calm down Daniel Jackson. They will infact calm up.
Offline Profile Quote Post Goto Top
 
Go to Next Page
« Previous Topic · Questions about Ultimate 3D · Next Topic »
Add Reply