babylonjs

babylon.js how to get access to a mesh outside of it's function

旧巷老猫 提交于 2021-01-05 11:20:41
问题 I just cant get access to the babylon mesh. Everytime I try to run the code I get this error. I've tried it with two different approaches: Example 1: var carTest; BABYLON.SceneLoader.ImportMesh("", "assets/", "car.obj", scene, function(object) { carTest = object[0]; }); carTest.position.x = 10; Example 2: var carTest = BABYLON.SceneLoader.ImportMesh("", "assets/", "car.obj", scene); carTest.position.x = 10; 回答1: In your example 2, The BABYLON.SceneLoader.ImportMesh return Nullable

babylon.js how to get access to a mesh outside of it's function

落爺英雄遲暮 提交于 2021-01-05 11:20:34
问题 I just cant get access to the babylon mesh. Everytime I try to run the code I get this error. I've tried it with two different approaches: Example 1: var carTest; BABYLON.SceneLoader.ImportMesh("", "assets/", "car.obj", scene, function(object) { carTest = object[0]; }); carTest.position.x = 10; Example 2: var carTest = BABYLON.SceneLoader.ImportMesh("", "assets/", "car.obj", scene); carTest.position.x = 10; 回答1: In your example 2, The BABYLON.SceneLoader.ImportMesh return Nullable

Babylon.js - models created with Blender appear rounded and weirdly shaped

早过忘川 提交于 2019-12-23 01:53:25
问题 I am working on a Babylon.js project. Therefore I created a test model (.babylon) with Blender (the export worked perfectly without any errors). My Problem is: The model in my browser 1 (Babylon.js) looks somewhat different than the model in Blender 2. Model in babylon Model in blender To import the mesh to my Babylon scene, i am using BABYLON.SceneLoader.ImportMesh . Babylon.js seems to somehow round the edged, which I really don't understand - there are plenty of examples of perfect models!

Scene rendering strangely in babylonjs

久未见 提交于 2019-12-13 04:28:09
问题 So, I've loaded my scene I made in Blender into Babylonjs, and it's producing some interesting effects. Basically, I am trying to apply gravity and such to the scene, move the player to it's proper location, and make the entire scene lit and visible, but none of that is working. This is the script: var BABYLON; var canvas = document.getElementById('gamecanvas'); var engine = new BABYLON.Engine(canvas, true); var player_height = 2; var player_speed = 1; var player_inertia = 0.9; function INIT

Loading local files into a Babylonjs scene directly

て烟熏妆下的殇ゞ 提交于 2019-12-12 00:47:49
问题 Babaylonjs is able to load babylon, gltf, obj and files into a scene. How to load a model, and its accompanying files like images for textures (or e.g. bin file for gltf , mtl file for obj ), file selected from a file select dialog by an html input type=file ? Note the accompanying files can be in arbitrary directories beside the main model file. Note : Babylonjs Assets Manager and SceneLoader methods all http requests from a server. They are not what I look for. Also http posting a file to

How to render images in WebGL from ArrayBuffer

和自甴很熟 提交于 2019-12-11 11:24:04
问题 I am having a image that I am reading in server side and pushing to web browser via AJAX call. I have a requirement where I have to render them line by line using WebGL. For Example : Image is 640X480 where 640 is width and 480 is height. Now the total number of pixels will be 640*480 = 307200 pixels. So, I want to render the whole image in 640(total width) intervals in a loop using WebGL. Now I have texture2D(as per my knowledge) in webgl to do so, but not getting any idea of where to start

How to create a Texture from a ArrayBuffer in html5 and WebGL

女生的网名这么多〃 提交于 2019-12-11 00:49:15
问题 I am having a image that I am reading in server side and pushing to web browser via AJAX call. I have a requirement where I have to render them line by line using WebGL. For Example : Image is 640X480 where 640 is width and 480 is height. Now the total number of pixels will be 640*480 = 307200 pixels. So, I want to render the whole image in 640(total width) intervals in a loop using WebGL. Now I have texture2D(as per my knowledge) in webgl to do so, but not getting any idea of where to start

How to create a custom mesh in Babylon.js?

别等时光非礼了梦想. 提交于 2019-12-10 22:36:27
问题 I'm using the babylonjs 3D WebGL library. It's great library, but I can't find the same, which exists in THREE.JS library. For example, I have 2D polygons in database, I'm fetching the polygon data from it and then create a custom mesh and extruding it. With the THREE.JS, there isn't any problem, I can add to some array: ... points.push( new THREE.Vector2( part.x, -part.y ) ); ... var shape = new THREE.Shape( points ); var extrusion = { amount: building.height, bevelEnabled: false }; var

How to prevent Closure Compiler from renaming any property or method of a specific object?

只愿长相守 提交于 2019-12-02 18:07:54
问题 I am working with a huge 3rdparty library (Babylon JS) that will be served from its own CDN and cannot be included in my Closure Compiler run. The library contains one object and everything defined as parts of it. It has no externs file available so I started to write one but it is growing quickly. It would be easier to just tell Closure Compiler to not mangle any properties I am setting, including the ones I am setting on objects created by constructors on the object. EDIT: Added the name of