Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / MouseX() and MouseY() restricted to Resoloution of App, anyway to change this?

Author
Message
Mr Bigglesworth
18
Years of Service
User Offline
Joined: 4th Mar 2008
Location:
Posted: 5th Nov 2010 10:00 Edited at: 5th Nov 2010 10:01
I am making a RTS game, and I am using Position object Cur, MouseX(), 0, MouseY() to postion the 3D cursor/pointer thing, but MouseX and MouseY are restricted to the screen res of my program. This is a problem because you can't move the mouse pointer out of a small area. Is there anyway to unrestrict or a different method to make an object follow the mouse and not be restricted, many thanks
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 5th Nov 2010 10:33
You can increment the positions of the object with mousemovex() and mousemovey(). Or you could use a more advanced system and find the intersection point on the terrain where the mouse is currently pointing, and then position the object there. I believe the command is get pick vector(), but I'm not that sure.

TheComet

baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 5th Nov 2010 15:42
The mousemove commands are a little unreliable though and will not always match what mousex() and mousey() do... you would loose a lot of accuracy going down that route.

I'm not sure how to answer your question though sorry!

Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 5th Nov 2010 15:51
Look into using PICK OBJECT instead, like pass the mouse position to it, and your terrain object, and it will return the 3D position of your mouse. You can use this to find out which object you clicked on as well, by passing the range of objects you want to detect to it. Damn handy command, I wish DBPro had it when I wrote my RTS.

PICK OBJECT(x,y,startobj,endobj)

Then GET PICK VECTOR X()+camera position x() is the returned X position - you can do the same for Y and Z of course.

Health, Ammo, and bacon and eggs!
Benjamin
23
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 5th Nov 2010 15:58
Isn't there a command to translate 2D to 3D coordinates?
Mr Bigglesworth
18
Years of Service
User Offline
Joined: 4th Mar 2008
Location:
Posted: 5th Nov 2010 19:03
Cool, thanks, tonight I will try using PICK OBJECT when I get home.

Login to post a reply

Server time is: 2026-07-26 05:03:25
Your offset time is: 2026-07-26 05:03:25