martende Posted May 1, 2015 Share Posted May 1, 2015 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 ? Quote Link to comment Share on other sites More sharing options...
xerver Posted May 1, 2015 Share Posted May 1, 2015 https://github.com/pixijs/examples Now interaction manager is a plugin loaded up by a renderer system. You can access it like: renderer.plugins.interaction.mouse Quote Link to comment Share on other sites More sharing options...
martende Posted May 1, 2015 Author Share Posted May 1, 2015 Thanx Quote Link to comment Share on other sites More sharing options...
MercuryAX Posted September 14, 2015 Share Posted September 14, 2015 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. Quote Link to comment Share on other sites More sharing options...
OnGe Posted October 3, 2015 Share Posted October 3, 2015 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? Quote Link to comment Share on other sites More sharing options...
OnGe Posted October 3, 2015 Share Posted October 3, 2015 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... ianmcgregor 1 Quote Link to comment Share on other sites More sharing options...
MercuryAX Posted October 5, 2015 Share Posted October 5, 2015 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.