lars Posted April 4, 2018 Share Posted April 4, 2018 Hello Im trying to make my spine object interactive: var player = new game.Spine('mySpine.json'); //player.hitArea = new game.Rectangle(200, 500); player.position.set(300, 800); player.interactive = true; player.play('idle', true); //player.speed = 0.01 player.addTo(this.stage); player.click = function() { console.log('check clicked'); }; That did not work. I tried to put it in a container. That did not help either. It works OK an a sprite object. Quote Link to comment Share on other sites More sharing options...
enpu Posted April 4, 2018 Share Posted April 4, 2018 Hi @lars I would suggest you to put your Spine object into a container that has custom hitArea defined. Use hit area debugging to visually see where the hit area is and then resize and position it how you want. var container = new game.Container(); container.interactive = true; container.hitArea = new game.Rectangle(200, 400); container.hitArea.x = -100; container.hitArea.y = -400; player.addTo(container); You can find the hit area debugging button from the bottom of the game window. Quote Link to comment Share on other sites More sharing options...
lars Posted April 5, 2018 Author Share Posted April 5, 2018 Ok. I tried that to, and I cannot visual see the debug draw in the Panda2 editor when activate #. If I work outside Panda2 editor (Brackets) would i still be possible for me to debug the hit area in a browser like: ?debugDraw=true Heres what i tried (I startet with a class, but for now, to test is down to basic :-) : var container = new game.Container(); container.position.set(300, 800); container.interactive = true; container.hitArea = new game.Rectangle(237.15, 218.37); container.hitArea.x = -200; container.hitArea.y = 218; container.addTo(this.stage); var player = new game.Spine('kristian-ronnie.json'); //player.hitArea = new game.Rectangle(200, 500); //player.position.set(300, 800); player.play('idle', true); player.addTo(container); container.click = function() { console.log('check clicked'); }; } Quote Link to comment Share on other sites More sharing options...
enpu Posted April 5, 2018 Share Posted April 5, 2018 Are you using Pixi plugin? Hit area debugging doesn't currently work while rendering in WebGL, so try to disable it, debug your hit area and then turn back on. Quote Link to comment Share on other sites More sharing options...
lars Posted April 5, 2018 Author Share Posted April 5, 2018 Yes im using Pixi plugin and my spine works fine, but is not interactive. Where do I disable webGL. Tried to set it to false in the config. Quote Link to comment Share on other sites More sharing options...
enpu Posted April 5, 2018 Share Posted April 5, 2018 Just comment out the pixi plugin and restart your game .require( // 'plugin.pixi' ) Quote Link to comment Share on other sites More sharing options...
lars Posted April 5, 2018 Author Share Posted April 5, 2018 That did it. thank´s a lot :-) 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.