Matriax

Members
  • Content count

    40
  • Joined

  • Last visited

1 Follower

About Matriax

  • Rank
    Advanced Member

Contact Methods

  • Website URL
    https://kronbits.itch.io
  • Twitter
    DavitMasia

Profile Information

  • Gender
    Male
  1. I tried to do a ramp in blender, export as ramp3.babylon and in the plugin code i do this: BABYLON.SceneLoader.ImportMesh("Cube", "", "ramp3.babylon", scene, function (newMeshes, particleSystems) { }); The ramp is loaded at 0,0,0 position with the correct collision, that means i can go up to the ramp and slide down, instead of get the collision box. So seems with this function i can load the entire scene(removing "Cube" at first) or select the mesh objects i want to import in the scene. Before mark as solved i'm gonna test more complex stuff to see if works in all ways. Any tips or things to consider using this method? What mesh collision is imported with this? Uses the "mesh" form collision?
  2. I can't provide a PG because i'm using Babylon via plugin for a game engine called Construct2 but i found a way to add direct babylon code. So if the plugin have some bug or missing features i can use babylon code adding it in the correct place from a solution provided. So, he .OBJ loaded in Babylon only supports bounding boxes ? What happens if i have a complex object or mini-scene with multiple meshes? There is no way to set to that object a precise collision rather than a simple bounding box? If i load a .Babylon scene to the game exported from blender i can do ramps,etc... and the collisions are precise. Why for .OBJ imports are only bounding box?. I will try to import .OBJ on blender and export as .babylon scene to see if i can load them into the same scene to get the correct collisions. Edit: I added a Physics behaviour and i can set the impostor: Box, Sphere, Plane. Cylinder, Mesh, Heightmap. But always that run is the same box. Btw, for NeMesh objects if i change the box to sphere it really works. So maybe in the editor i select one or other but when load the .OBJ applies the bounding box. So, i need the code to set the mesh physic impostor collide to a mesh manually with direct babylon code, mmm
  3. Any imported .OBJ have this box collisions. How i can set to the object the correct collisions or use the collision=mesh ? Maybe is there any function to force the correct collision in case are bad loaded or something ¿? . I don't know if there is something wrong on my .OBJ, the plugin or simply babylon v2.6 not accept the collision and just draw a box? Here is the .obj i'm using: https://drive.google.com/file/d/0B8vm3FpJ3vqJT1RlNFIxTldLcU0/view?usp=sharing
  4. And also they need to be ordered correctly to be 4-5-6-7
  5. @aWeirdo I read that tutorial and based with it but had lots of issues to figure things so i finally do it in numbers, without variables, to see what is problem and as @brianzinn said there is two sides that need a 90º rotation that killed me. After see all you have to do for map a simple cube... i think i'm not gonna go in this way. So seems that or will load the .OBJ of a cube with the mapped or using a plane for walls, or maybe create a cube with 6 planes, each one with X texture and after that rotate in X.Y from the center of the mesh.
  6. The idea is create a box and texture each side of the cube, but is so frustating, trying to guess the UV coordinates for each face wich change on each one the coordinates, btw i got this, but still lot of work guessing the other faces, so frustrating https://www.babylonjs-playground.com/#1V3CAT#263 So, my cuestion is , if there is a way more easy to do all this. I mean, maybe some function on you tell that there is 4 textures in horizontal, 4 textures in vertical and babylon with that info know this: So instead the coordinates like this: faceUV[0] = new BABYLON.Vector4(0.25, 0.75 ,0.5 ,0.5); faceUV[1] = new BABYLON.Vector4(0.25, 0.5 ,0.5 ,0.75); We do something like: faceUV[0] = new BABYLON.Tile(1); faceUV[1] = new BABYLON.Tile(4); Or if this can't be done, any way more easy to texture the 6 sides of the cube adding one different texture for each face?
  7. Import .js models in Babylon ?

    I see, so that .js is not supported, thanks! other thing less to check XD
  8. Import .js models in Babylon ?

    This is the code inside the Babylon3D plugin for C2 that load the .OBJ and .JS file. There is more code but i are variables and C2 stuff, i put here only the part that i think does the work: instanceProto.tick2 = function () { if (this.runtime.scenes[this.properties[1]]) { // Is scene defined if (!this.created) // We didn't create the mesh yet { var rot = this.properties[5].split(","); //XY rotation var xpos = this.x - (this.runtime.original_width / 2); var ypos = - (this.y - (this.runtime.original_height / 2)); var zpos = this.properties[7]; var scene = this.runtime.scenes[this.properties[1]]; var i; var inst = this; var loader = new BABYLON.AssetsManager(scene); loader.useDefaultLoadingScreen = false; BABYLON.OBJFileLoader.OPTIMIZE_WITH_UV = true; var container = BABYLON.Mesh.CreateBox("mesh" + this.uid, 1, scene); container.position = new BABYLON.Vector3(xpos, ypos, zpos); container.rotation.z = -inst.angle; container.scaling = new BABYLON.Vector3(inst.width, inst.height, inst.properties[6]); var posOffs = this.properties[8].split(","); var scaOffs = this.properties[9].split(","); container.visibility = 0.5; container.isVisible = this.properties[10]; container.isPickable = true; container.isBlocker = true; if (this.properties[4] == 0) { // OBJ var OBJ = loader.addMeshTask("ObjLoader" + this.uid, "", "", this.properties[3] + ".obj"); OBJ.onSuccess = function (t) { t.loadedMeshes.forEach(function (m, i) { inst.objmeshes[i] = m; inst.objmeshes[i].parent = container; inst.objmeshes[i].scaling = new BABYLON.Vector3(container.getBoundingInfo().boundingBox.extendSize.x, container.getBoundingInfo().boundingBox.extendSize.y, container.getBoundingInfo().boundingBox.extendSize.z); inst.objmeshes[i].position = new BABYLON.Vector3(posOffs[0], posOffs[1], posOffs[2]); inst.objmeshes[i].scaling.x *= scaOffs[0]; inst.objmeshes[i].scaling.y *= scaOffs[1]; inst.objmeshes[i].scaling.z *= scaOffs[2]; inst.objmeshes[i].rotation.x = rot[0] * (Math.PI / 180); inst.objmeshes[i].rotation.y = rot[1] * (Math.PI / 180); inst.objmeshes[i].rotation.z = rot[2] * (Math.PI / 180); inst.objmeshes[i].isPickable = true; }); }; loader.onFinish = function () { inst.loaded = true; }; if (container.isReady) { this.runtime.trigger(cr.plugins_.babylonOBJ.prototype.cnds.MeshOnReady, this); } } else { BABYLON.SceneLoader.ImportMesh("", "", this.properties[3] + ".js", scene, function (m, particles, skeletons) { for (var i = 0; i < m.length; i++) { inst.objmeshes[i] = m; inst.objmeshes[i].parent = container; inst.objmeshes[i].scaling = new BABYLON.Vector3(container.getBoundingInfo().boundingBox.extendSize.x, container.getBoundingInfo().boundingBox.extendSize.y, container.getBoundingInfo().boundingBox.extendSize.z); inst.objmeshes[i].position = new BABYLON.Vector3(posOffs[0], posOffs[1], posOffs[2]); //inst.objmeshes[i].scaling = new BABYLON.Vector3(scaOffs[0], scaOffs[1], scaOffs[2]); inst.objmeshes[i].scaling.x *= scaOffs[0]; inst.objmeshes[i].scaling.y *= scaOffs[1]; inst.objmeshes[i].scaling.z *= scaOffs[2]; inst.objmeshes[i].rotation.x = rot[0] * (Math.PI / 180); inst.objmeshes[i].rotation.y = rot[1] * (Math.PI / 180); inst.objmeshes[i].rotation.z = rot[2] * (Math.PI / 180); inst.objmeshes[i].isPickable = true; } inst.loaded = true; if (skeletons[0]) { container.skeleton = skeletons[0]; } }); if (container.isReady) { this.runtime.trigger(cr.plugins_.babylonOBJ.prototype.cnds.MeshOnReady, this); } } loader.load(); this.created = true; } if (this.loaded) { if (this.properties[2] == 1) // Construct 2 is taking the wheel { if (!this.done) { var xscale = this.runtime.scenes[this.properties[1]].getMeshByName("mesh" + this.uid).scaling.x; var yscale = this.runtime.scenes[this.properties[1]].getMeshByName("mesh" + this.uid).scaling.y; this.width = (this.runtime.scenes[this.properties[1]].getMeshByName("mesh" + this.uid).getBoundingInfo().boundingBox.extendSize.x * xscale) * 2; this.height = (this.runtime.scenes[this.properties[1]].getMeshByName("mesh" + this.uid).getBoundingInfo().boundingBox.extendSize.y * yscale) * 2; this.x = this.runtime.scenes[this.properties[1]].getMeshByName("mesh" + this.uid).position.x; this.y = -this.runtime.scenes[this.properties[1]].getMeshByName("mesh" + this.uid).position.y; this.angle = -this.runtime.scenes[this.properties[1]].getMeshByName("mesh" + this.uid).rotation.z; this.set_bbox_changed(); this.done = true; this.hotspotX = 0.5; this.hotspotY = 0.5; this.update_bbox(); } else { this.runtime.scenes[this.properties[1]].getMeshByName("mesh" + this.uid).rotation.z = -this.angle; // Euler this.runtime.scenes[this.properties[1]].getMeshByName("mesh" + this.uid).position.x = this.x; this.runtime.scenes[this.properties[1]].getMeshByName("mesh" + this.uid).position.y = -this.y; //this.runtime.scenes[this.properties[1]].getMeshByName("mesh"+this.uid).isVisible = this.visible; //this.runtime.scenes[this.properties[1]].getMeshByName("mesh"+this.uid).visibility = this.opacity; this.runtime.scenes[this.properties[1]].getMeshByName("mesh" + this.uid).scaling.x = this.width / (this.runtime.scenes[this.properties[1]].getMeshByName("mesh" + this.uid).getBoundingInfo().boundingBox.extendSize.x * 2); this.runtime.scenes[this.properties[1]].getMeshByName("mesh" + this.uid).scaling.y = this.height / (this.runtime.scenes[this.properties[1]].getMeshByName("mesh" + this.uid).getBoundingInfo().boundingBox.extendSize.y * 2); } } else // We don't need to check again { this.runtime.untick2Me(this); } } } }; The .js file i'm using is the simple default cube startup on blender exported with the io.three addon you can download here: https://drive.google.com/file/d/0B8vm3FpJ3vqJbGdJbmdCQ0xfU0k/view?usp=sharing The code inside the .js model is this: { "uvs": [], "name": "CubeGeometry", "metadata": { "uvs": 0, "generator": "io_three", "version": 3, "materials": 1, "normals": 8, "vertices": 8, "faces": 6, "type": "Geometry" }, "normals": [0.577349,-0.577349,-0.577349,0.577349,-0.577349,0.577349,-0.577349,-0.577349,0.577349,-0.577349,-0.577349,-0.577349,0.577349,0.577349,-0.577349,-0.577349,0.577349,-0.577349,-0.577349,0.577349,0.577349,0.577349,0.577349,0.577349], "vertices": [1,-1,-1,1,-1,1,-1,-1,1,-1,-1,-1,1,1,-1,0.999999,1,1,-1,1,1,-1,1,-1], "faces": [35,0,1,2,3,0,0,1,2,3,35,4,7,6,5,0,4,5,6,7,35,0,4,5,1,0,0,4,7,1,35,1,5,6,2,0,1,7,6,2,35,2,6,7,3,0,2,6,5,3,35,4,0,3,7,0,4,0,3,5], "materials": [{ "transparent": false, "visible": true, "depthWrite": true, "depthTest": true, "specularCoef": 50, "colorSpecular": [1,1,1], "colorDiffuse": [0.415,0.010957,0.009576], "opacity": 1, "DbgName": "Material", "colorAmbient": [0.415,0.010957,0.009576], "DbgColor": 15658734, "DbgIndex": 0, "shading": "phong", "blending": "NormalBlending", "wireframe": false, "colorEmissive": [0.38595,0.01019,0.008906] }] } I tried using various exported properties like "face materials" i saw in a tutorials that seems have to be checked for import correctly on three.js , and other options but nothing always get the same, an invisible model but is there due i can collide with him. I can only see if i turn on a debug property that makes the zone some white-50% alpha, this: Whithout that debug thing property i not see the cube but i can collide. I tried using flipfaces, make visible and other properties in case the export not have this values checked but nothing worked.
  9. Import .js models in Babylon ?

    Well, seems tower of babel is not available anymore, or changed the site ¿? . I can export an .OBJ(a simple model/object) and a .Babylon file(Scene with camera, lights,etc..) from Blender and runs ok. My question is that i also can see there is in the lugin a .js import for models, like three.js , but when i import the .js on babylon not appears nothing but is there because the camera collides with it, and if i apply the debug to that mesh i can see a transparent cube. So I'm not sure if import a .js model can be imported on Babylon v2.6 or not, was deprecated or something or i'm missing something.
  10. Is possible import .js models into babylon? In the plugin i have that uses babylon.js engine appears ".js" and ".obj". Installed a js exporter on Blender and got a .json file, i rename it to .js and tried to import in a babylon scene but not appears nothing, so i don't know if is not possible, was deprecated... the plugin uses the Babylon v2.6. I searched in docs and can't find anything about that, only .OBJ files,.
  11. @JohnK Thanks! Worked perfectly! Last thing, any idea that how avoid negative values?
  12. I'm getting the freecamera values but they are radians and if i continue rotate they increase more than 6.28 or less than -6.28 . So whay i do for conversion actually is: (camera.rotation.y*360)/6.28 So i get the camera values as i want. But i can figure how fix the infinite rotation value thing, maybe there is some function or something i missing to avoid that?
  13. Well, seems the example parameters were to high, after some test i got ones that works ok for the dof: dof_focus_distance: 1, dof_aperture: 0.3, Needs some tweaks to works as the real life or enough for a game, but i guess i will have to experiment with things like: dof_focus_distance: 1 / (camera.z/50), (or play with the aperture) I mean, try to start lose the focus only at x distance instead from 0 distance and after that do it at X level. The depthofField on the standr pipeline i was unable to get work correctly but there is some other effects that looks so good and i have to test, so thanks for the link!
  14. Yes this is what a need the distance, but works inverse when you are too near, to explain better here is an image: So maybe is there some parameter to fix this, or some math to avoid that when you are too near the dof do weird things? I tried the Standard pipeline and the same happens, when you are close to the object starts to blur again ¿?. Like at 50 distance of the object the DOF is 0 (sharp) and when you go close to the object like 0 distance you get -50 dof or something. How i can fix that ¿?