Temechon Posted December 18, 2015 Share Posted December 18, 2015 Check this: http://doc.babylonjs.com/tutorials/How_to_use_the_Tags_SystemOh, you mean in the babylon file. Nevermind. Quote Link to comment Share on other sites More sharing options...
dbawel Posted December 19, 2015 Share Posted December 19, 2015 I would agree with Dad72 and others to create a class to add tags to scene objects - only for the reason that this should simplify many processes as well as scene optimizaion - and also the potential to use these "tags" in addition or possibly instead of global variables - to allow more versatility to call and operate on element properties - which I have often found limitations when using extensions or other functions which require variations in script formatting - where I've too often been unable to affect some scene element's properties without having to reformat my script. And to DK, your proposal for function and usage of mesh "tags" appears complete to me at first glance, and I can not think of anymore to add to the description of how you might implement this feature into the babylon.js framework - although I haven't yet read all of the posts in this thread, so I hope I'm not to pre-mature in offering my opinion. Although I know that if this is the case, I will certainly hear about it shortly. If this is not yet a formal request on the Babylon feature request site, then please make the request and provide the link, so that I may add my name to the request - as I'm certain others will also. Cheers, DB Quote Link to comment Share on other sites More sharing options...
Dad72 Posted December 20, 2015 Share Posted December 20, 2015 Tags now exist Dbawel. this topic is quite old and had gwenael add this feature (tags). its documentions here:http://doc.babylonjs.com/tutorials/How_to_use_the_Tags_System Quote Link to comment Share on other sites More sharing options...
dbawel Posted December 21, 2015 Share Posted December 21, 2015 Dad72, I definately had overlooked this, and athough I realized this was an old post, I hadn't enquired to see if tags had been already introduced - as I didn't realize how old this post was. However, this is no excuse, as I could have easily looked at the dates and realized I was reading posts 18+ months old - which is about how old I feel right now in my age at grasping the BJS framework and available features almost 2 years old now. Thank you for not making me look like a complete idiot, as I have been very good at doing this myself - and would have been such an easy target. So I owe you one (at least), and will use much more caution in the future before I open up my big mouth and spout out such jibberish. I'll crawl back into my hole now. Quote Link to comment Share on other sites More sharing options...
jessepmason Posted December 21, 2015 Share Posted December 21, 2015 haha sorry, It's partly my fault, I wasn't too sure on whether to comment on a really old post or start a new one Quote Link to comment Share on other sites More sharing options...
JBP Posted August 19, 2016 Share Posted August 19, 2016 On 4/8/2014 at 4:32 PM, Deltakosh said: I won't add .userData because we are all using javascript and so we can add custom properties whenever we want. tags are important to organize objects but userData is just user data I agree, but if I use TypeScript I can't just add a property. And the Tag system in my perspective is not efficient for what I need. I need a reference/pointer whatever to connect my Babylon object/mesh to my Game Object. Can anyone help me ? Quote Link to comment Share on other sites More sharing options...
Wingnut Posted August 20, 2016 Share Posted August 20, 2016 Hi @JBP, welcome to the Babylon.js forum! I am certainly no BJS expert or a Typescript user... but I thought I would share the following BabylonJS Playground demo. It does lots of "lookups" - various ways to find references to mesh, lights, cameras, etc. It uses the BJS built-in arrays... scene.lights, scene.cameras, scene.meshes, and even a user-made array called allpoles. http://playground.babylonjs.com/#AAZIU#0 That playground demo also does some basic animation... using the handy scene.beforeRender property and a function within. You might wish to view your browser's F12 Dev Tools to view the JS console. There are some reports being sent there. Maybe this helps. Perhaps I'm off-topic. Others may understand the issue better than I. Can you give us more details about your concerns? Thanks. Again, welcome to the forum.... good to have you with us. Be well. JBP 1 Quote Link to comment Share on other sites More sharing options...
JBP Posted August 20, 2016 Share Posted August 20, 2016 Hi @Wingnut thanks for the reply, but at I need is a way to reference/point to a Game Object from a Babylon Mesh. For example there is a collision between two meshes and I need to subtract energy from a game object, I know witch meshes collided but from the meshes I can't go directly to the game object. At least in TypeScript I think. Wingnut 1 Quote Link to comment Share on other sites More sharing options...
adam Posted August 20, 2016 Share Posted August 20, 2016 I keep a list of game objects using the game object's mesh uniqueid as a key. It looks something like this: gameObjectsByMesh = []; addGameObject(gameObj){ this.gameObjectsByMeshID[gameObj.mesh.uniqueId] = gameObj; } getGameObjectByMesh(mesh){ return this.gameObjectsByMeshID[mesh.uniqueId]; } JBP 1 Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted August 20, 2016 Share Posted August 20, 2016 Or, mesh["feet"] = "stink"; JBP and Dieterich 1 1 Quote Link to comment Share on other sites More sharing options...
JBP Posted August 20, 2016 Share Posted August 20, 2016 1 hour ago, adam said: I keep a list of game objects using the game object's mesh uniqueid as a key. It looks something like this: gameObjectsByMesh = []; addGameObject(gameObj){ this.gameObjectsByMeshID[gameObj.mesh.uniqueId] = gameObj; } getGameObjectByMesh(mesh){ return this.gameObjectsByMeshID[mesh.uniqueId]; } Thanks for the tip. 12 minutes ago, JCPalmer said: Or, mesh["feet"] = "stink"; Thanks for the tip. 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.