Jump to content

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


JeZxLee
 Share

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

Link to comment
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

Link to comment
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.

Link to comment
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

Link to comment
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...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...