About Store Forum Documentation Contact
Donations:
289$/mo



Post Reply 
Mouse position inside GUIs
Author Message
SamNainocard Offline
Member

Post: #1
Mouse position inside GUIs
I currently figuring how to get a Ms.pos inside GUI. As Ms.pos is return coordinate of application.

   

So, if I have 2 viewports covering the screen like in this picture, if I place a mouse at red dot, (center of screen) it would return 0.00, 0.00

If I place a mouse at blue dot (center of left viewports) is should return -0.50, 0.00, so how to make it return 0.00, 0.00 like it is a whole screen instead?
I want to shoot a ray from the mouse inside these viewport.

Thanks in advance.
11-07-2011 06:25 PM
Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #2
RE: Mouse position inside GUIs
Simply offset the x-value of Ms.pos by adding 0.5f when in the first viewport; when in the second, subtract 0.5f.
11-07-2011 09:10 PM
Find all posts by this user Quote this message in a reply
SamNainocard Offline
Member

Post: #3
RE: Mouse position inside GUIs
Thanks for reply.

The problem is ScreenToPosDir(Ms.pos(), pos, dir);
dir at red will be (0.00, 0.00, 1.00) while blue will be around (-0.50, 0.00, 0.866)

Unless there's a function that make things easier so I guess I have to do a simply way by offset the value.
(This post was last modified: 11-08-2011 05:33 AM by SamNainocard.)
11-08-2011 05:32 AM
Find all posts by this user Quote this message in a reply
Post Reply