Dad72 Posted November 18, 2015 Share Posted November 18, 2015 Hello The action on the recently add sprites not working. I test the demo on playgroud and when one clicks the sprite 'player', nothing happens. http://www.babylonjs-playground.com/#9RUHH#3 Quote Link to comment Share on other sites More sharing options...
RaananW Posted November 18, 2015 Share Posted November 18, 2015 Set it pickable - http://www.babylonjs-playground.com/#9RUHH#5 Quote Link to comment Share on other sites More sharing options...
Dad72 Posted November 18, 2015 Author Share Posted November 18, 2015 This demo should be updated in the doc: http://doc.babylonjs.com/tutorials/How_to_use_Actions#sprites and why we must put in pickable spriteManager and sprites? it is repetitive, right?var spriteManagerPlayer = new BABYLON.SpriteManager("playerManager", "textures/player.png", 2, 64, scene); spriteManagerPlayer.isPickable = true;var player = new BABYLON.Sprite("player", spriteManagerPlayer); player.isPickable = true; Quote Link to comment Share on other sites More sharing options...
RaananW Posted November 18, 2015 Share Posted November 18, 2015 The sprite predicate is as follows: var spritePredicate = (sprite: Sprite): boolean => { return sprite.isPickable && sprite.actionManager && sprite.actionManager.hasPickTriggers; };The object has to be pickable, has to have an action manager and a pick trigger should be registered. You can of course create your own predicate is you want to pick the sprite differently, if you pick (for example) in a beforeRender loop. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 18, 2015 Share Posted November 18, 2015 Doc is updatable. Please do edit it is nearly impossible to keep everything up to date without community help Quote Link to comment Share on other sites More sharing options...
Dad72 Posted November 18, 2015 Author Share Posted November 18, 2015 Yes I understand. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted November 18, 2015 Author Share Posted November 18, 2015 it is done RaananW 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 18, 2015 Share Posted November 18, 2015 THank you:) 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.