Quantcast
Channel: Babylon.js
Viewing all 388 articles
Browse latest View live

How to remove together the mesh and particles from scene?

$
0
0

When I double-click remove mesh and start the particle at 1 second. And I assume that after the particles are removed together with the mesh from the scene.

 

But if I again double click will do it again the particles appear again.

How to remove together the mesh and particles?

 

Example: http://www.babylonjs-playground.com/#7JOOL


I cannot locate a "time" property for a video texture

$
0
0

I need to add a shuffle slider to my scene to scrub through the videoTexture.  I don't believe there is a property for time such as in buiding a direct HTML5 video player.  If there is one such as VideoTexture.video.time() please let me know.  Otherwise, my solution is to load both a forward and backward playing video and manipulate those.  Lot's of work.  :(

 

Thanks.

struggling with a blender file.....

$
0
0

Hi everybody !!!!  I am going deeper and deeper into the mix babylon.js and Blender.  It's been 2 months that I am following tutorials on both platform....  I want to progress.  My problem right now it's some Blender files that I have to port in babylon.js.  For example,  the one I give to you it's a blender  file when I am using it in my code with my local server, the wall are not there....  It happens quite a lot with Blender files ported in babylon.js that some texture aren't working.....  It's very fun to work with babylon.js though.....

 

Blender file link :https://drive.google.com/file/d/0B_ZBy6q5jS8xc2t1ckZtaUh3OGc/view?usp=sharing

Express.js with Babylon files

$
0
0

The newest Express doesn't really seem to be handling the Babylon files correctly, even after setting the mime types.

I'm using express.static with a folder, and every time BabylonJS downloads the file but doesn't create a mesh afterwards. Going to the link directly in your browser downloads the mesh instead of showing the data (not sure if this is intended)

The appropriate mime types are set, looking them up by file extension also returns these types.

 

Basically the code to have the mime types is this:

express.static.mime.define({
    'application/babylon': ['babylon'],
    'application/fx': ['fx'],
    'application/babylonmeshdata': ['babylonmeshdata']
});

app.use(express.static('YOUR FOLDER'));

Client:

BABYLON.SceneLoader.ImportMesh("test", "objs/", "skull.babylon", scene, function (newMeshes) {
	console.log("mesh loaded");
	console.log(arguments); // This logs: [Array[0], Array[0], Array[0]]
});

skull.babylon is the skull which you see often on the Babylon playground.

 

The Chrome Networking tool returns this for skull.babylon:

 

 

    1. Remote Address:
      [::1]:3000
    2. Request URL:
    3. Request Method:
      GET
    4. Status Code:
       
      200 OK
  1. Response Headersview source
    1. Accept-Ranges:
      bytes
    2. Cache-Control:
      public, max-age=0
    3. Connection:
      keep-alive
    4. Content-Length:
      4130385
    5. Content-Type:
      application/babylon
    6. Date:
      Tue, 17 Nov 2015 16:27:23 GMT
    7. ETag:
      W/"3f0651-1509a80b833"
    8. Last-Modified:
      Sat, 24 Oct 2015 15:38:58 GMT
    9. X-Powered-By:
      Express
  2. Request Headersview source
    1. Accept:
      */*
    2. Accept-Encoding:
      gzip, deflate, sdch
    3. Accept-Language:
      nl-NL,nl;q=0.8,en-US;q=0.6,en;q=0.4
    4. Cache-Control:
      no-cache
    5. Connection:
      keep-alive
    6. Host:
      localhost:3000
    7. Pragma:
      no-cache
    8. Referer:
    9. User-Agent:
      Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36
 
It seems that the networking tool actually does get the correct information:
 
But that "newMeshes" in the client code returns an array of size 0

Problem with VertexData.Merge

$
0
0

If Positions, Normals, etc can now be Float32Arrays, VertexData.merge() fails.  This is because receiving mesh's array does not have a push function.  This is one of the only differences between typed arrays and Javascript arrays:  typed arrays are of fixed size at the time of construction.

 

Think a merge that will always work is one that:

  • computes the new size of the combination,
  • instances a new array of the final size
  • references receiving array by index

Think we should be creating a new method like, _mergeElement, that does this and returns the new array which should replace the old one.  The current structure of Merge() is quite long,  adding this extra stuff, would increase that.  having a sub method might actually have less code.

 

I double checked for references to push().  They are contained to the canned geometry / ribbon methods, so it looks like this is the only instance of this issue.  I have so many unfinished things that I cannot address this myself right now.  Wanted to bring it up, so anyone else who encountered it would know it was a known issue.

WebGL not supported when trying to implement a game menu

$
0
0

Hello..So I am in the phase of finishing our project and have been working on UI before the start of the game. I have been playing with HTML, importing images and so on. My code and game works if i only have canvas on it, as soon as i add other HTML elements such as images or divs, it says that webGL is not supported.. Please help me.. its driving me crazy.  :wacko:  :wacko:

Here is the HTML, that stops working : 

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
      <title>CleanItUp!</title>
      <link rel="shortcut icon" href="./assets/ikona.ico" type="image/x-icon"/>
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
      <style>
        html, body {
          overflow: hidden;
          width: 100%;
          height: 100%;
          margin: 0;
          padding: 0;
        }

        #renderCanvas {
          width: 100%;
          height: 100%;
          touch-action: none;
        }
        .image{
            width: 100%;
            height: 100%;
        }
        .menu{
            position: absolute;
            top: 30%;
            left: 15%;
        }
        .menu1{
            position: absolute;
            top: 50%;
            left: 15%;
        }
      </style>
      <script type="text/javascript" src="./scripts/Babylon/dist/babylon.2.2.max.js"></script>
      <script type="text/javascript" src="./scripts/handjs/bin/hand.1.3.8.js"></script>
      <script type="text/javascript" src="./scripts/Babylon/dist/Oimo.js"></script>
       <script type="text/javascript" src="./scripts/engine.js"></script>
   </head>

   <body>

        <img id="image" src="menuBackground.png">
        <div id ="gumbi">
            <img class="menu" src="playbutton.png" onclick="hideDivs(); createScene();">
            <br><br>
            <br><br>
            <img class="menu1" src="controlsbutton.png">
        </div>

   <canvas id="renderCanvas"></canvas>

   </body>

</html>

Heres my hideDivs code which only hides the divs and images i created, so the scene can be rendered on it :

function hideDivs(){
    var image = document.getElementById("image");
    image.style.visibility = 'hidden';
    var divImages = document.getElementById("gumbi");
    divImages.style.visibility = 'hidden';
}

I can also pastebin the main part of code (createScene, but it has around 700 lines and it works fine if i delete this part of the code).

Babylon Commandline Interface

$
0
0

Hey ,

this is a verry early stage of a little pythonscript to make the work with Babylon a little bit faster.

Its a CLI wich makes it easy to create a bisc proejct structure ( including a simple webserver ), add basic shapes, include .babylon files and add a prototype class for more complex objects.

https://github.com/steffenkre/babylonbackbone


Here are the parameters:

new <name> creates a new project

newclass <name> creates a new prototype class in man.js
newplane <name> creates a simple plane in middle of the scene
newcube <name> creates a simple plane in middle of the scene
newmesh <name> imports a new .babylon mesh from the assets Folder

What do you think about it? Whats missing?

SpotLight issue

$
0
0

Hi, Babylon.JS Fellows :)

I want to make image vignetting and animation with help of SpotLight.

I have been playing a lot with Babylon spot light and cannot avoid sharp inner circle where light begin decrease.

Check this out: http://www.babylonjs-playground.com/#1IC7R#1

Light falls off  to the dark very smooth, but starts falling off with sharp line. I tried to play with properties, but cannot get result of smooth beginning of falling off.  When I use this light in animation, I can clearly see this sharp line, where lite begins to decrease, and it is bad. Maybe someone know what can I do with it. changing of position, exponent, angle, intensity properties does not resolve this strange behavior.

Thank you!

 


The Skeleton animation is not smooth when change...

$
0
0

a man is doing waiting animation,

 

press 'asdw', now doing running animation, it looks jump frame...

 

and when stop running, change to waiting, also not smooth...

Khronos News and BabylonJS Fame

Action for sprites

Model w/non-skinned animation

$
0
0

I have a model with a non-skinned animation (no rig, pieces animated through rotations of sub-meshes).

To my surprise these models run when loaded on Babylon.  Problem is not all the animation is playing, and the animation loops. 

 

How do you control these "non-skinned" animations?

 

Thanks

 

- Nick

Serialize scene not complete

$
0
0
When you serialize a scene, some property is not serialized.
 
I did not check everything, but that are not present in a scene serialized.

 

- enablePhysics

- collisionsEnabled

- workerCollisions

 

and when an object is deleted, the materials used by the deleted objects are serialized anyway, but should not be..

Clara.io export to babylon

$
0
0

Hi I am new to Babylon and 3d modelling in general.

I manage to get the basics down. 

 

I am trying to export a basic model into babylon however

it never seems to initialize. I tried the same import file in

the babylon sandbox and get the same black scene with the 

loading circle.

 

My scene in clara.io is pretty simple, its an upside down

tetrahedron.

 

https://clara.io/view/2ee8381f-23f5-4eeb-b682-01e6f68f037d

 

I also tried exporting it to blend and I get some error.

 

Any ideas on what I could be doing wrong?

thanks

 

zak

Issue with intersecting meshes on initialization

$
0
0

I am new to babylon and am creating a space game based on gravity and mesh intersection. Basically, my game states are being managing and determined based on if a ship mesh is intersecting with a destination or obstacle mesh. Looks something like this:

 

  scene.registerBeforeRender(function()
  {  
    if (ship.canvasObject.intersectsMesh(canvasObjects[0].canvasObject, true)) {
      ship.material.emissiveColor = new BABYLON.Color3(0, 1, 0);
      PubSub.publish('COLLISION EVENT', 'collided')      
    }
 
    for(var i = 1; i < canvasObjects.length; i ++){
      if (ship.canvasObject.intersectsMesh(canvasObjects[i].canvasObject, true)) {
        ship.material.emissiveColor = new BABYLON.Color3(1, 0, 0);
        PubSub.publish('COLLISION EVENT', 'collided with other stuffs')
      }
    }
 
Where ship is a prototype. When the page loads, it says that the meshes are already intersecting once, then they stop intersecting, and then they intersect again. The positions of each are (-20, 1, -20) and (25, 1, 25). I feel like there's something simple-ish here that I'm missing and I've gone through all the docs but can't figure it out. 
 
Any help appreciated!

Kolobok game

$
0
0

Hi guys,

I'd like to present you my project, which I've been working on during the last year.

The development is still in progress, so it doesn't have fancy interface and not very optimized, but it's a nice POC of Babylon.js framework.

The game supports desktop (mouse + keyboard) and mobile (gyroscope and accelerometer) controls.

Share your thoughts, any inputs and comments are highly appreciated.

Need advice for make Shader

$
0
0

Hi, guru's!

 

I need advice or dig direction.

 

Problem:

Make shader material (glsl) and in vertex shader i change vertexes position. It work ok and results is pretty.

 

BUT (yes, again this damn "BUT") :)

 

In fragment shader i need normal for compute reflection, diffuse and etc.

 

Source mesh is flat, and all normal look up and equal.  Vertex shader change vertex position, but normals stay not changed.

 

How i can recalculate (or get somewhere :)) ) new normals?  In vertex shader i have only ONE current vertex, but for calculate normal we need face (i think :) i.e. 3 vertexes).

How get new normal in current vertex in new position? Help please!

 

p. s.

http://www.babylonjs.com/cyos/  Template "wave"  we have near situation, but normal (as i understand) not recalc and in distortion result we not get real light piscture.... or have?  Trap...

 

SSAO not working in IOS Safari

$
0
0

Somebody has an idea why SSAO is not working in Ipad? (tested with IOS 9.1)

I can't see any effect if i enable SSAO. ... only a huge performance drop but this was expected :rolleyes:

On my desktop the same test works correctly.

 

The ssao example on babylonjs.com also doesn't work on Ipad.

Apply bone orientation and position to mesh without attaching

$
0
0

Hi!

 

In my scene I have multiple instanced robots with single skeleton. When two of them get near enough each they should start shooting lasers.

 

Skeleton has a bone named "Arm.Gun L", its position and orientation already define the origin from where the laser is shot and its direction vector, the problem is that I can't find a way how to access the data. It need to be accessed and copied only once.

 

Find the bone:

this._bone = skeletons[0].bones.filter((b: BABYLON.Bone) => {
	return b.name === "Arm.Gun L";
})[0];

And when firing:

var l = this._laser.createInstance("l");
l.position = ? // this._bone.?
l.rotation = ? // this._bone.?

After looking through the docs for Bone and InstancedMesh (together with its base classes Mesh and Node) the only useful thing I found are local and globalMatrix methods on bones (if I could apply localMatrix to laser would probably do what I want with some minor fixes), but haven't found any efficient way of applying to a laser.

Water material black smudges

$
0
0

Hi!

 

I added water material (latest from Github repo) to my BJS (2.3 alpha) scene, showed it to my friend and got back print screen below. It also flickers from time to time.

 

Graphics card is Nvidia Geforce 550 Ti, with latest drivers (updated today)

Issue can be reproduced on BJS Playground in the materials section for water: http://www.babylonjs-playground.com/#1SLLOJ#17

Attached Thumbnails

  • IMG_19112015_153311.png
Viewing all 388 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>