JeZxLee

"InteractionManager"-Get Where Mouse Screen (X, Y)?

Recommended Posts

Hi,

Looking at the documents, in "InteractionManager" pages.
I can't seem to find house to get mouse screen x, y ?

If I just use mouse functions would that support basic touch input on mobile?

Thanks!

JeZxLee

Share this post


Link to post
Share on other sites

Sorry for the new post, tired...

I am completely lost with getting mouse/touch coordinates.
Need something simple for now that supports both computers and mobile.
(multi-touch will be added at a much later date)


Can you just write a small example which puts the (x, y) of mouse/touch in the following global variables?:

var MouseX = 0;
var MouseY = 0;
var MouseButtonClicked = false;
var MouseButtonDown = false;

 

JeZxLee

Share this post


Link to post
Share on other sites
5 minutes ago, JeZxLee said:

Sorry for the new post, tired...

I am completely lost with getting mouse/touch coordinates.
Need something simple for now that supports both computers and mobile.
(multi-touch will be added at a much later date)


Can you just write a small example which puts the (x, y) of mouse/touch in the following global variables?:


var MouseX = 0;
var MouseY = 0;
var MouseButtonClicked = false;
var MouseButtonDown = false;

 

JeZxLee

Just go sleep ^_^. Coords are in "renderer.plugins.interaction.mouse.global", and if you want multitouch, you have to handle it per event, it cant be done with global vars.

Share this post


Link to post
Share on other sites

Hi,

I have the following code:
 

function GetMouseTouchScreenXY()
{
	var mouse = renderer.plugins.interaction.mouse.global;
	MouseX = mouse.x;
	MouseY = mouse.y;
	
	if (mouse.mousedown)  MouseButtonDown = true;
	else if (MouseButtonDown == true)
	{
		MouseButtonDown = false;
		MouseButtonClicked = true;
	}
	else
	{
		MouseButtonDown = false;
		MouseButtonClicked = false;
	}
}

The mouse coordinates work on computers but not Android?
Also the clicking on left mouse button is not working?

What am I doing wrong, the documentation on mouse input is confusing...

JeZxLee

Share this post


Link to post
Share on other sites

That works, thanks...

Still no touch coordinates on my Android devices? (no x,y - but touch is detected)
Do I have to do something special to get the above?

JeZxLee

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.