Jump to content

Action for sprites


Dad72
 Share

Recommended Posts

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;
Link to comment
Share on other sites

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.

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