Jump to content

InteractionManager v3


martende
 Share

Recommended Posts

In v2 stage had InteractionManager, but v3 has no stage 

what is analog of 

 

// animate loopvar mouse = stage.interactionManager.mouse;player.x = mouse.global.x;player.y = mouse.global.y;

and another questions - has any working v3 examples already exist ?

Link to comment
Share on other sites

  • 4 months later...

Thank you!  I was also able to get my mouse sprite dragging in v3.  However, is getting the mouse position through the interaction manager supposed to work for touch as well?  I'm having issues getting touch to work correctly, using mostly code adapted from the bunny dragging example.  

Link to comment
Share on other sites

  • 3 weeks later...

Im trying to get mouse or touch position on screen and have problems with it. With mouse its fine with renderer.plugins.interaction.mouse.global.x but cant get such coordinates for touch. When dumped InteractionManager, i found there is no such thing like renderer.plugins.interaction.touch, but there is methods like .onTouchStart(), .onTouchMove() and so on... but there is nothing about it (see: http://www.goodboydigital.com/pixijs/docs/classes/InteractionManager.html - no methods, just properties that should contain functions, but nothing about it )

 

It could be great if there is something about it in documentation. Tutorial would be wonderful! Trying to reverse engineer it is not quite as much fun as it may look...

 

Anyway, does anyone have some idea how to get touch x/y coordinates?

Link to comment
Share on other sites

To allow this stuff to work with touch as well, you can just use eventData.data instead of mouse. See the snippet bellow.

// display x - y coordinates for mouse onlyconsole.log(renderer.plugins.interaction.mouse.global.x + ' - ' + renderer.plugins.interaction.mouse.global.y);// display x - y coordinates for mouse or touch eventsconsole.log(renderer.plugins.interaction.eventData.data.global.x + ' - ' + renderer.plugins.interaction.eventData.data.global.y);

May seem obvious, but to find that out...

Link to comment
Share on other sites

Yeah, I'm still having trouble getting my sprites to behave properly when dragging on mobile with 3.0.7.  I have one sprite that can either move up or down, and will only move up, and it'll go as "up" as it can before stopping.

 

EDIT: Nevermind, I fixed everything by following the new examples.  I'm an idiot.

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...