Jump to content

Recommended Posts

Hi all :)

I m newbie on Babylon since 2 days from Turkiye ;

I created a scene on 3dsmax and exported to babylon file format

scene working good on browser with textures (firefox) 

then  added a arcrotate camera is good 

added some lines and i can scale rotate etc lines worked :

now its a problem for me :( ;

i want manuplate a mesh in imported babylon file for scale rotate or move or change texture

i can see mesh name on mesh tree,

when i add this line on script file

mymeshname.rotation.y = Math.PI / 6;

scene cant load on browser :(((

How to select mesh in babylon file ?? and change scale rotation texture etc.  please help me 

 

its html file working

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

        <title>Babylon imported max</title>
        <!-- Babylon.js -->
        <script src="./JS/babylon.2.3.js"></script>
           <style>
            html, body {
                overflow: hidden;
                width: 100%;
                height: 100%;
                margin: 0;
                padding: 0;
            }

            #renderCanvas {
                width: 100%;
                height: 100%;
                touch-action: none;
            }
        </style> 
</head>
<body>
    <canvas id="renderCanvas"></canvas>
 
 <script>
    
    if (BABYLON.Engine.isSupported()) {
        var canvas = document.getElementById("renderCanvas");
        var engine = new BABYLON.Engine(canvas, true);
     
        BABYLON.SceneLoader.Load("", "kek.babylon", engine, function (Scene) {
   
           Scene.executeWhenReady(function () {
   
    var camera = new BABYLON.ArcRotateCamera("Camera", 0, 0, 50, BABYLON.Vector3(0,0,0), Scene);
        Scene.activeCamera = camera;
        camera.attachControl(canvas, true);
        camera.setPosition(new BABYLON.Vector3(0,2000,-3000));
        camera.lowerBetaLimit = 0.1;
        camera.upperBetaLimit = (Math.PI / 2) * 0.9;
     
            Scene.debugLayer.show();
     
    var lines = BABYLON.Mesh.CreateLines("lines", [
        new BABYLON.Vector3(0, 0, 0),
        new BABYLON.Vector3(1000, 1000, 500)
    ], Scene);

 

      
// PROBLEM HERE ???   ******************************************************  "kaldirim" is my mesh name in babylon file ***********         
      //  kaldirim.rotation.y = Math.PI / 6;
 // PROBLEM HERE ???   **********************

 

  
                engine.runRenderLoop(function() {
                    Scene.render();
                });
            });
        }, function (progress) {
            // To do: give progress feedback to user
        });
    }
  
</script>
 </body>
</html>

 

Thanks all :)

 

Link to post
Share on other sites

Hi All :)

I solved this problem 

just added this var definition :

var newKaldirim = Scene.getMeshByName("kaldirim");        
    
            newKaldirim.rotation.y = Math.PI / 6;

then worked well :)

i found this way in forum topics   

thank you very much 

JCPalmer

Happy with BabylonJS  woot!!

Link to post
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...
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...