Jump to content

Physics in Babylon.js


Recommended Posts

Hi everybody,


I am new in Babylon. I needsomehelp as follows: I copied, from Babylon.js site, source for Physics demo (the one with a lot of red-white spheres). I copied also babylon.js, cannon.js and hand.js. I wite a main.js function :


    window.onload = function(){
    var canvas = document.getElementById("canvas");
    // Check support
    if (!BABYLON.Engine.isSupported()) {
        window.alert('Browser not supported');
    } else {
        // Babylon
        var engine = new BABYLON.Engine(canvas, true);
        //Creating scene
        scene = CreatePhysicsScene(engine);
        // Once the scene is loaded, just register a render loop to render it
        engine.runRenderLoop(function () {
        // Resize
        window.addEventListener("resize", function () {


The html is like that :


        <title>First Babylon experience</title>
        <script src="js/hand.js"></script>        
        <script src="js/cannon.js"></script>
        <script src="js/babylon.js"></script>
        <script type="text/javascript" src="js/main.js"></script>
        <script type="text/javascript" src="js/physicsscene.js"></script>
        <style type="text/css">
            html,body,#canvas {
                overflow: hidden;
        <canvas id="canvas"></canvas>


Everything works, except for the fact that all spheres pass through the floor, they don't bump like in the demo. I checked the files and they are OK. May be I missed something but I don't know what.




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.

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.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...