aqualonix Posted February 12, 2018 Share Posted February 12, 2018 Hi! Sorry for the simple question! With this code I have an animation that character's eyes are tracking to mouse from the start and another unique animation when I'm clicking on the character. But I want to change it for "click and hold" so eyes are tracking mouse while user is holding his left button and eyes stop following mouse after button release. And I want to save option for unique animation with single click. Sorry, maybe its a stupid question, but I'm really stuck, I checked http://pixijs.download/dev/docs/PIXI.interaction.InteractionManager.html, but another events aren't working. live2dSprite.on('click', (evt) => { const point = evt.data.global; if (live2dSprite.hitTest('body', point.x, point.y)) { live2dSprite.startRandomMotionOnce('tap_body'); } }); live2dSprite.on('mousemove', (evt) => { const point = evt.data.global; live2dSprite.setViewPoint(point.x, point.y); }); Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted February 12, 2018 Share Posted February 12, 2018 I dont know whether live2d actually has containsPoint or any other function that allows pixi to detect whether the object was clcked. Which runtime do you use? Quote Link to comment Share on other sites More sharing options...
aqualonix Posted February 12, 2018 Author Share Posted February 12, 2018 7 minutes ago, ivan.popelyshev said: I dont know whether live2d actually has containsPoint or any other function that allows pixi to detect whether the object was clcked. Which runtime do you use? live2dSprite.hitTest can detect it but I want allow to click and hold anywhere in the renderer (even on the character) for eyes to start following the mouse and click and release only on the character's body to start unique animation. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted February 12, 2018 Share Posted February 12, 2018 Then you have to be familiar with pixi interaction to hook live2d in it properly. You can ask in official live2d js repo about it. and if they dont have solution for it, we'll have to help them make better plugin. Quote Link to comment Share on other sites More sharing options...
aqualonix Posted February 12, 2018 Author Share Posted February 12, 2018 7 minutes ago, ivan.popelyshev said: Then you have to be familiar with pixi interaction to hook live2d in it properly. You can ask in official live2d js repo about it. and if they dont have solution for it, we'll have to help them make better plugin. I just can't understand how to change "mousemove" to "click and pressed". Its not about live2d, I'm just stuck on it right now. Maybe I can use if, but how can I stop mousemove after first activation? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted February 12, 2018 Share Posted February 12, 2018 pointerdown, pointermove, pointerup did you do that for DOM or canvas without pixi or in other platform that is not HTML5? If not, I'm afraid that's more coding question then. Look at dragging example http://pixijs.io/examples/#/demos/dragging.js Quote Link to comment Share on other sites More sharing options...
aqualonix Posted February 12, 2018 Author Share Posted February 12, 2018 4 minutes ago, ivan.popelyshev said: pointerdown, pointermove, pointerup did you do that for DOM or canvas without pixi or in other platform that is not HTML5? If not, I'm afraid that's more coding question then. Look at dragging example http://pixijs.io/examples/#/demos/dragging.js canvas, I was thinking how to do it only with one event Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted February 12, 2018 Share Posted February 12, 2018 It cant be done with only one event. If you find a library/framework of the same level as Pixi, or phaser or Flash, or web DOM, that can do that with only one event - I'd like too see it. 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.