mrmdes Posted June 28, 2017 Share Posted June 28, 2017 Hi people! Babylonjs is an amazing bit of code and I am extremely grateful for it's very existence. Thank you for creating it and releasing it for free. Now... I am feeling a bit silly for asking this but I seem to have hit a bit of a road block. How do I access objects on the JSON so that I can instruct a camera to move to them smoothly ( to set as the central focus in the camera's rotational sphere ) and look at them while they are moving towards them. If fact, how do I access JSON items full stop? I know the names of the items in my JSON as I created it in blender and loaded it in the babylonjs editor but I can not seem to call them from code at all. I am also able to load it in BabylonJS. It is all there, ready to go but ... I ... CANT .... PLAY .... WITH .... IT ;-( What is the best way to address these items in JS? I can create a new mesh like basic cube and interact with it by following all of the super helpful tutorials and am considering just loading my scene as separate objs but I am thinking this could be a lot of potentially unnecessary extra work. Thank you very much in advance. I want to become a pro at BabylonJS but just need to get over this first hurdle! :-) ----- EDIT: I figured out the above and it was so simple that I feel like a complete dunce! I was tempted to delete this post to save my pride but I think it is worth leaving around for any other noobs to find! If you create a box in JS in babylonjs eg: var movingbox = BABYLON.Mesh.CreateBox("box", 3.0, newScene); You can move the box on the x like this: movingbox.position.x = -5; If your models is part of the Json this works exactly the same way but you must call your model first: staticbox = scene.getMeshByName("staticbox"); ----- While I am in an asking sort of mood: can I call an action created in the action editor from JS? I have managed to do all sorts of other camera related bits from an overlaid html UI I have created. Marc Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 29, 2017 Share Posted June 29, 2017 yes you can your mesh will have an actionmanager and thus: mesh.actionManager.processTriger() See a complete example here: https://www.babylonjs-playground.com/#YITJU9#31 (line #97) Quote Link to comment Share on other sites More sharing options...
mrmdes Posted June 30, 2017 Author Share Posted June 30, 2017 Thank you very much for the reply. That is amazing! It's so simple. I found a way to do what I wanted in JS without needing access to the action in the end. For future projects, this will be a lot quicker and very useful. :-) Another quick one.... Can I protect my files somehow? If I didn't want someone downloading and re-using my JSON for instance? Cheers, Marc Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 30, 2017 Share Posted June 30, 2017 Unfortunately as everything is run on the client there is no simple way to protect your data. This is the very nature of the web 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.