Babylon3D: Standard Edition

  • X3M I posted the FreeCamera problem on the Babylon.js forums here:

    http://www.html5gamedevs.com/topic/2774 ... n-on-move/

    Hope somebody finds a solution or a way to fix it, i tried in all ways i know and never get the behaviour desired, also i want to create some kind of switch to deactivate/activate and use it as Walk/Jetpack.

    ---

    About use babylon.js functions on C2, how optimized/fast will be compared with the babylon3D plugin? I mean, the same function using Babylon3D action or executing Babylon.js functions in events have any difference?

  • matriax No they are the same, you simply execute the function with Browser->Execute javascript.

    I will give you all the parameters you will need, although I'll post a video tutorial on my youtube channel after my basic tutorials :

    The scene object:

    this.runtime.scenes[ID]

    ID: Is the scene ID you set in C2.

    Example:

    Browser  |Execute javascript "this.runtime.scenes[0].clearColor.r = 255;"[/code:1haseumt]
    [b]Explanation:[/b] Change the scene 0 red color to 255.
    
    [b][h2]The mesh object:[/h2][/b]
    this.runtime.scenes[ID].getMeshByName("&"'mesh"+UID)
    [b]UID:[/b] Is the mesh UID.
    [b]Example:[/b][code:1haseumt]Browser  |Execute javascript "this.runtime.scenes[0].getMeshByName("&"'mesh3'"&").visiblity = 0.5;"[/code:1haseumt]
    [b]Explanation:[/b] Set the opacity of the mesh with UID 1 to 0.5
    
    [b][h2]The light object:[/h2][/b]
    this.runtime.scenes[ID].getLightByName("&"'light"+UID)
    [b]UID:[/b] Is the mesh UID.
    [b]Example:[/b][code:1haseumt]Browser  |Execute javascript "this.runtime.scenes[0].getLightByName("&"'light4'"&").intensity= 0.0;"[/code:1haseumt]
    [b]Explanation:[/b] Set the intensity of the light with UID 4 to 0.0
    
    [b][h2]The camera object:[/h2][/b]
    this.runtime.scenes[ID].getCameraByName(name)
    [b]name:[/b] Is the name you have given to the camera in the left properties tab (Property above scene ID )
    [b]Example:[/b][code:1haseumt]Browser  |Execute javascript "this.runtime.scenes[0].getCameraByName("&"'myCamera'"&").position += 1.0;"[/code:1haseumt]
    [b]Explanation:[/b] Move the camera named myCamera by 1 on the X axis
    
    Visit [url=http://www.babylonjs-playground.com/#]the BabylonJS playground[/url] to experiment with your code
  • The first example works perfect, the other don't, maybe because they have a "" ?

    Example

    Browser  |Execute javascript "this.runtime.scenes[0].getMeshByName("mesh3").visiblity = 0.5;"[/code:bmh9wjyv]
    
    I created a NewMesh = Cylinder, with Cylinder as object name and mesh name. This Cylinder have UID=27 on C2.
    
    I tried this:
    [code:bmh9wjyv]"this.runtime.scenes[0].getMeshByName(""Cylinder"").visiblity = 0.5;"[/code:bmh9wjyv]
    [code:bmh9wjyv]"this.runtime.scenes[0].getMeshByName(""Cylinder""+27).visiblity = 0.5;"[/code:bmh9wjyv]
    [code:bmh9wjyv]"this.runtime.scenes[0].getMeshByName(""Cylinder""27).visiblity = 0.5;"[/code:bmh9wjyv]
    [code:bmh9wjyv]"this.runtime.scenes[0].getMeshByName(""Cylinder+27"").visiblity = 0.5;"[/code:bmh9wjyv]
    
    But none worked.  I added double "" to get working if not i get an error syntax on C2 expressions. How have to be done correctly? What i'm missing?
  • matriax Fixed , between it should be mesh27 and not Cylinder27

  • the plugin is fully functional now?i mean is 100% ready for a game?

  • X3M Waiting the video tutorial to see real examples working :S .

    So seems for the Light and Mesh objects they refer to the UID: Light4, Mesh21,etc... but for the camera uses the mesh name in the left tab, not the C2 name, the one that uses Babylon that appear above "Scene ID".

    I have the Light thing working now, on press I > Light2 to 0.0 intensity and the execute javascript works this:

    "this.runtime.scenes[0].getLightByName(""light2"").intensity= 0.0;"[/code:3f0v4518]
    
    But the mesh still not works. I have NewMesh objects and OBJ-Mesh and tried:
    "this.runtime.scenes[0].getMeshByName("&"'mesh20'"&").visiblity = 0.5;"
    "this.runtime.scenes[0].getMeshByName("&"'mesh24'"&").visiblity = 0.5;"
    "this.runtime.scenes[0].getMeshByName("&"'mesh27'"&").visiblity = 0.5;"
    etc.... But none worked.
    
    The camera seems is detected but when i try to apply your javascript code i get this error:
    [img="https://i.imgsafe.org/e43794988e.png"]
    [code:3f0v4518]"this.runtime.scenes[0].getCameraByName("&"'Camera'"&").position += 1.0;"[/code:3f0v4518]
  • X3M Maybe it's me, but i'm trying adjust X/Y/Z coordinates and seems for each action i want to do even for the same plugin they changes.

    I was trying to set a bullet in front of the camera and for clone mesh the X/Z works in a way and for set position in other. In both cases the bullet appears in front the camera but for each action the axis works different?.

  • Found this when i tried to parent a NewMesh to the camera:

    ---

    EDIT2 - Y.rotation solved!!

    In the post about avoid the Y.rotation Deltakosh posted this example:

    http://www.babylonjs-playground.com/#GZ1YB

    (thread: http://www.html5gamedevs.com/topic/2774 ... n-on-move/)

    The thing that avoid the Y to fly is this:

        camera._updatePosition = function() {
            this.cameraDirection.y = 0;
            this.position.addInPlace(this.cameraDirection);
        }[/code:3qdr3eei]
    
    In execute javascript seems with only this already works:
    [code:3qdr3eei]"this.runtime.scenes[0].getCameraByName(""camera"").cameraDirection.y = 0;"[/code:3qdr3eei]
    
    This can be done actually with the Babylon3D actions? I tried some of them adding Y to 0 but none worked or this is another expresion? In that case will be great have the DIrections X/Y/Z for the next update with all the other minor fixes with camera degress,etc...
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • The "execute javascript" for mesh works, the thing not works is change the visibility of the mesh.

    I tried to change the visibility of a mesh picking by UID using the Babylon3D actions but nothing happens for OBJ-Mesh objects. On NewMesh objects works.

    I tried to erase a mesh picking by UID using the execute javascript and works perfect:

    "this.runtime.scenes[0].getMeshByName(""mesh35"").dispose() ;"[/code:10irrxbk]
    
    Seems the problem is the "visibility" action for OBJ-Mesh ¿?. Or why works on NewMesh and not on OBJ.Mesh?
  • X3M Seems the Nearest_Sampligmode and anisotropicFiltering is set on each texture. If you provide the action to enable or disable them, if we have a family called "3D_OBJ" i guess we will can do a: For each "3D_OBJ" > Set Nearest | Filtering=1, or whatever, right?

    I tried with the execute javascript but i don't know exactly the code for that, i tried things like this:

    "this.runtime.scenes[0].getMeshByName(""mesh35"").Texture.NEAREST_SAMPLINGMODE);" [/code:3uf4bms9]
    [code:3uf4bms9]"this.runtime.scenes[0].getMeshByName(""mesh35"").Texture.anisotropicFilteringLevel = 1;"[/code:3uf4bms9]
    
    But i guess this is not how it works. I'm looking this playground example:
    [quote:3uf4bms9]http://www.babylonjs-playground.com/#1IKIXK#5
    
    Other example about SamplingMOde:
    [quote:3uf4bms9]http://babylonjs-playground.com/#121HCT#0
    
    
    How i access to the texture functions of a mesh with execute javascript to modify this things? Maybe for this things i have to have in mind the material name of the mesh to change their properties?
  • matriax I'm posting an update soon.

  • matriax I'm posting an update soon.

    Great to ear that!.

    ---

    About the Texture.SamplingMode, i opened a thread on Babylon.JS in case you want to take a look to see if you have some idea that how implement something for deactivate filters:

    http://www.html5gamedevs.com/topic/2780 ... r-applied/

  • X3M Are the Spotlights working for NewLights?

    I'm using your FPS example to test the lights and the unique i can't get is the Spotlights. I tried to change all the variables and position but nothing happens never. If they are working will be great update the FPS example to show how.

    EDIT: - Finally get the Spotlights working but they are so confusing. I guess for lights better import a scene with the setup made with a 3D editor. BTW, I will try to do something for the light to make a setup in runtime to edit each variable to see in real time what is going on if not this will be imposible.

  • matriax It is because spotlights have a complicated setup, they are hard to configure and may take some time to figure out the correct settings, because they need extra parameters unlike the other lights.

    Detailed explanation:

    A spotlight consists of a cone which has a target, Deltakosh made this target a world position (X,Y,Z), which is unconvinient for us C2 users because we can't determine the exact position which we want our spotlight to be casting on. So to solve this, I've set the target to be an offset instead of a position, the offset's origin is 0,1000,0. This means that when you create a spotlight without changing anything in the properties, even if Target is 0,0,0 , the spotlight will cast 0,1000,0 , so that the spotlight will be shown to you like this:

    Target property is an offset of X,Y,Z . If it is 0,0,0 , then the spotlight will target the position 0,1000,0.

    If it is 100,0,0, then the spotlight will target 100,1000,0 , so it will display like this:

    If you have a better idea or configuration for it, then tell me.

  • X3M Mmm, about to make it more easier, is there anyway to show the lights form? Like in the 3D editors, to at least have some reference of what we are doing/editing.

    With the debug enabled i achieved to show the mesh colissions/forms and names:

    Maybe there is some option that can make the lights form/shape visibles? By Babylon code or Debug? That will help a lot. Also we can modify the values of the light in the debug to see in real time how affect that helps a bit.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)