Kilombo

Members
  • Content Count

    145
  • Joined

  • Last visited

Everything posted by Kilombo

  1. Really great stuff mate, good work. We are really missing one alternative to cannon.js
  2. Quite strange really, I took wingnut example, and added another box and sphere 1 pixel bigger, then I parented them to the first ones, and the problem got a bit better. I think that maybe cannon.js creates something like a "invizible box" that makes the original one a bit larger but it gets unseen (just specullating of course). Where's the example: http://www.babylonjs.com/playground/#26L9IU#1
  3. Good evening everyone, I'm currently importing a lot of meshes to my project (blender), although everyting is looking fine in blender, in Babylon things get weird. I'm pretty sure i'm missing something (probably something really basic). I'll leave the printscreens has example. (sorry for the big images, didn't thought printscreen would cache the other monitor ). The first image is what is happening in the game, and the second image his the result that I want, and is what blender shows.
  4. Too bad , This would be really a cool feature, imagine how easy it to explode one imported mesh with this feature Thanks anyway. I have to do a work around.
  5. I Dk, Does the animation importer supports the blender particle system and the explode modifier? I'm starting to think that can be something relationed with that. Cause when I check in the console log (with console.log(this.mesh)) it returns "animations: Array[0]", so... there's no animation exported Do you know of some problem relationed with this features ?
  6. Good afternoon everyone, I'm trying to beginAnimation with one imported mesh from blender, but something is going wrong cause nothing happens. Supposely, the animation is started when a ship is destroyed, can some one take a look? I'm missing something for sure. The animation consists on the ship beeing destroyed, so I putted a particle system on the mesh and added a modifier (explosion) (in blender of course), it's supposed to work. But it's not.... unit.prototype.setMesh = function (mesh){ this.mesh = mesh; this.mesh.position.x = this.getShipPosx(); this.mesh.position.z = this.getShipPosz(); this.mesh.rotation.y = this.getShipRotation(); this.mesh.position.y = 0; if (this.destroy === true){ console.log("chega aqui"); scenes[0].beginAnimation(ship, 0, 100, true); console.log(ship); this.destroy = false; }};unit.prototype.setDamage = function(power) { if (this.shieldSize > 0){ this.shieldSize = this.shieldSize - power; } else if (this.shieldSize < 0){ this.shieldSize = 0; } else { this.armor = this.armor - power; } if (this.armor <= 0){ this.armor = 0; this.destroy = true; this.setMesh(this.mesh); }};unit.prototype.load3D = function(name,imageFileName,posx,posz,roty,meshid,type,octree){ var temp = this; BABYLON.SceneLoader.ImportMesh(name, "Assets/babylonreadyfiles/", imageFileName, scenes[0], function(newMeshes) { ship = newMeshes[0].clone(); ship.scaling.x = constants.shipScale; ship.scaling.y = constants.shipScale; ship.scaling.z = constants.shipScale; ship.actionManager = new BABYLON.ActionManager(scenes[0]); if (selfchecker === 0) { selfchecker = 1; temp.setShipPos(posx,posz,roty); //temp.loadParticlesEngine(newMeshes[0]); }; makeOverOut(ship,meshid,type); octree.dynamicContent.push(ship); octree.useOctreeForCollisions; //newMeshes[0].checkCollisions = true; temp.setMesh(ship); });};
  7. Hi Zimbofly, Since I work in OOP (objecto oriented programming) I had to do a work around. In the example below you have the function "load3D" of the class "Unit", so, when I do "var temp = this;", that variable will receive everything that concerns to the class or object it self, so I can use them in the "BABYLON.SceneLoader" method. By this, I can to whatever I want, you see that I do in the last lines "temp.setMesh(ship);", with this I'm passing the mesh it self by argument to another method of the classe called setMesh. On the setMesh I do all the stuff that I want. If it doesn't work out for you, please post the code, I'll give it a try on helping you out. Hope I've been helpfull. unit.prototype.load3D = function(name,imageFileName,posx,posz,roty,meshid,type,octree){ var temp = this; BABYLON.SceneLoader.ImportMesh(name, "Assets/babylonreadyfiles/", imageFileName, scenes[0], function(newMeshes) { var ship = newMeshes[0].clone(); ship.scaling.x = constants.shipScale; ship.scaling.y = constants.shipScale; ship.scaling.z = constants.shipScale; ship.actionManager = new BABYLON.ActionManager(scenes[0]); if (selfchecker === 0) { selfchecker = 1; temp.setShipPos(posx,posz,roty); //temp.loadParticlesEngine(newMeshes[0]); }; makeOverOut(ship,meshid,type); octree.dynamicContent.push(ship); octree.useOctreeForCollisions; //newMeshes[0].checkCollisions = true; temp.setMesh(ship); });};
  8. Great stuff mate, I bookmarked it, and I'll use it on my project for the university hehe in http://www.andromedaquest.com . I'll let you know when it's on Beta testing so you can see your musics on the game
  9. Mozzile for Android and Opera support WebGL and work. In Chrome you have to enable webgl.
  10. It's implemented. Quite easy actually. And works amazingly well. I load the scenes in a "sta.rt" function by calling two diferent funtions (each calls his scenes[0] and scenes[1]). Then, in the render loop i use some global booleans two trigger the rendering between them. There's the example code. function start() { canvas = document.getElementById("renderCanvas"); var info1 = document.getElementById("info1"); var info2 = document.getElementById("info2"); var shipposition = document.getElementById("shipposition"); if (!BABYLON.Engine.isSupported()) { window.alert('Browser not supported'); } else { renderCanvas = document.getElementById("renderCanvas"); engine = new BABYLON.Engine(renderCanvas, true); var systems = new Array(); systems = sceneSpace(); sceneBase(); };engine.runRenderLoop(function() {if (base === true){ space = false; scenes[1].render(); } if (space === true){ base = false; scenes[0].render(); } });Thanks for the help guys.
  11. Oh. Ok. that's different sorry I wasn't understanding your question. Can you post a playgroung link os a jsfiddle ?
  12. You want to move the mesh with physics enabled ? In that case, you have to set one impostor to the mesh and set the physics, something like this: scene.collisionsEnabled = true;scene.enablePhysics(); then on the meshes:mesh.setPhysicsState({ impostor: BABYLON.PhysicsEngine.BoxImpostor, mass: 0, friction: 0.5, restitution: 0.7 }); Then, you can apply impulse. But I don't use Cannon.js, and don't use physics at all. So I'm not the best person to help you on this. Sorry
  13. Hello yerzhik, You can check this link: http://www.html5gamedevs.com/topic/2264-move-forward-and-rotation/?hl=move Here you have a complete example of how to use keys to move a mesh in the render loop. Another complete example (fully functional) is the one in the http://www.babylonjs.com/ . Go there and check the Carlander Cargame. Anyway, you are setting the mesh to the same position where you draw it in the first place. Hope I've been helpfull.
  14. In fact, that looks really interesting... Hmmm. one array of scene objects That's one great idea. Where did that come from, eheheh I'll try it and report.
  15. Wingnut..... You are saving every body day I was just working on some buttons in Blender so that i could importe them has meshes. But your demo just solved my problem for the buttons, and dad72 problem. Thanks mate. I'll put you on the credits in my work (well..... isn't anything special, isn't ?!?!, lol ), you really helped me already in a bunch of things.
  16. Thanks Temechon. That's a good idea, it's so obvious.
  17. Thanks Temechon. Go to my project in http://www.andromedaquest.tk enter with username: xpto and password: xpto (I'll keep the user active for the next 24 hours at least). When you hoover the planets, you can see the option "colonize planets". And if a planet is already colonized, what will apear is base details. So... When that option is pressed the screen has to change to the "base" screen, I have to draw a new floor, with new texture, the structures and anything else. Then when the player presses "exit" it will come back to the "space ambient".
  18. Hey dad72, I took the Wingnut test. And this function came up: var makeOverOut = function(mesh,meshid,type) { function attrib(){onPointerOvermeshId = meshid;} function attribtype(){onPointerOverType = type;} mesh.actionManager.registerAction(new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPointerOutTrigger, myMouseOut)); mesh.actionManager.registerAction(new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPointerOverTrigger, myMouseOver)); mesh.actionManager.registerAction(new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPointerOverTrigger, attrib)); mesh.actionManager.registerAction(new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPointerOverTrigger, attribtype));}; so the meshid is a global var that receives whatever i want to have defined has a meshis (text, some description retrieved from database), then you can use to print it on the screen. Check the example, on my project. http://andromedaquest.tk/map.phpIf you move over the planets (when you turn the camera to the right), something will pop up (in this case a menu). I can give you more details, if you want.
  19. Hello community, I'm in need of help with something on my project. I need do draw a new scene in the same scene stuck in a while loop (while the option exit isn't pressed). By that I mean, that i would like to clear the all screen when this function is started, then, when exit is pressed, the "state machine" would come back to the main scene. I'm not beeing able to find any function to do this. Any suggestions ? Thanks in advance,
  20. Hi wingnut. I agree that PG is a wonderfull tool. I like it and use it a lot. But in some scenes, I can't use it. I don't know how to upload files (like meshes or textures), maybe it's not possible at all. But if it is.... It doesn't show anywhere. And yes.... All that i Know of how to work with PG, i learned by trial and error. And i've got to admit. In the beggining it's quite confusing.
  21. Hey mate. It looks great. And I'm sure it will be a success. Sugestions: 1- Make sure only the left button draws the roads and buildings. You can use if(event.which==1) {do something. Associated to your event listener. 2- The middle mouse button could rotate the camera when pressed. It looks promising, I'm following this topic. Keep posting news
  22. Yap it works, I didn't had my forked babylon sincronized. Thanks DK
  23. Sorry to bother again DK. But it's not working. In the example in the URL the lensflare should be _enabled = false (has it is), although it still draws. The distance is bigger then 18000 (has i defined) so it runs the method disposeParticle() (and in the console.log returns false). There's the class and in the end is the function. Do you find anything wrong or weird ? function system(posx,posz,planet1,planet2,planet3){ //luzes this.planet1 = planet1; this.planet2 = planet2; this.planet3 = planet3; this.posx = posx; this.posz = posz; this.light0 = new BABYLON.PointLight("Omni", new BABYLON.Vector3(this.posx, 0, this.posz), scene); this.lightSphere0 = BABYLON.Mesh.CreateSphere("Sphere0", 64, 40, scene); this.lensFlareSystem1 = new BABYLON.LensFlareSystem("lensFlareSystem", this.light0, scene); this.lightSphere0.position = this.light0.position; this.flare00 = new BABYLON.LensFlare(0.1, 0, new BABYLON.Color3(1, 1, 1), "Assets/lens5.png", this.lensFlareSystem1); this.flare01 = new BABYLON.LensFlare(0.3, 0.1, new BABYLON.Color3(0.5, 0.5, 1), "Assets/lens4.png", this.lensFlareSystem1); this.flare02 = new BABYLON.LensFlare(0.1, 0.5, new BABYLON.Color3(1, 1, 1), "Assets/lens4.png", this.lensFlareSystem1); this.flare03 = new BABYLON.LensFlare(0.2, 0.2, new BABYLON.Color3(1, 0.5, 1), "Assets/Flare.png", this.lensFlareSystem1); this.flare04 = new BABYLON.LensFlare(0.05, 0.3, new BABYLON.Color3(1, 1, 1), "Assets/lens5.png", this.lensFlareSystem1); this.flare05 = new BABYLON.LensFlare(0.2, 0.4, new BABYLON.Color3(1, 1, 1), "Assets/lens4.png", this.lensFlareSystem1); this.light0.range; this.light0.intensity;}system.prototype.activateLens = function(){ this.lensFlareSystem1._isEnabled = true;};system.prototype.disposeLens = function(){ console.log("entra no desligador"); this.lensFlareSystem1._isEnabled = false; console.log(this.lensFlareSystem1._isEnabled);};system.prototype.setSun = function(range,intensity){ this.lightSphere0.material = new BABYLON.StandardMaterial("white", scene); this.lightSphere0.material.diffuseColor = new BABYLON.Color3(1, 1, 1); this.lightSphere0.material.specularColor = new BABYLON.Color3(1, 1, 1); this.lightSphere0.material.emissiveColor = new BABYLON.Color3(1, 1, 1); this.lensFlareSystem1.borderLimit = 10; this.lensFlareSystem1.render; this.light0.range = range; this.light0.intensity = intensity;};system.prototype.getSunRange = function(){ return this.light0.range;};system.prototype.getSunIntensity = function(){ return this.light0.intensity;};system.prototype.getSunPositionX = function(){ return this.lightSphere0.position.x;};system.prototype.getSunPositionZ = function(){ return this.lightSphere0.position.z;};system.prototype.setPlanets = function (){ var temp = this; BABYLON.SceneLoader.ImportMesh(this.planet1, "Assets/babylonreadyfiles/", "planets.babylon", scene, function(newMeshes) { newMeshes[0].scaling.x = 500; newMeshes[0].scaling.y = 500; newMeshes[0].scaling.z = 500; newMeshes[0].position.x = (temp.posx)/2; newMeshes[0].position.y = 0; newMeshes[0].position.z = temp.posz/2; newMeshes[0].rotate(BABYLON.Axis.X, Math.PI/4, BABYLON.Space.LOCAL); newMeshes[0].actionManager = new BABYLON.ActionManager(scene); newMeshes[0].checkCollisions = true; newMeshes[0].setPhysicsState({ impostor: BABYLON.PhysicsEngine.SphereImpostor, mass: 0 }); makeOverOut(newMeshes[0]); }); BABYLON.SceneLoader.ImportMesh(this.planet2, "Assets/babylonreadyfiles/", "planets.babylon", scene, function(newMeshes) { newMeshes[0].scaling.x = 300; newMeshes[0].scaling.y = 300; newMeshes[0].scaling.z = 300; newMeshes[0].position.x = (temp.posx/2)+(temp.posx); newMeshes[0].position.y = 0; newMeshes[0].position.z = temp.posz/2; newMeshes[0].rotate(BABYLON.Axis.X, Math.PI/4, BABYLON.Space.LOCAL); newMeshes[0].actionManager = new BABYLON.ActionManager(scene); newMeshes[0].checkCollisions = true; newMeshes[0].setPhysicsState({ impostor: BABYLON.PhysicsEngine.SphereImpostor, mass: 0 }); makeOverOut(newMeshes[0]); }); BABYLON.SceneLoader.ImportMesh(this.planet3, "Assets/babylonreadyfiles/", "planets.babylon", scene, function(newMeshes) { newMeshes[0].scaling.x = 750; newMeshes[0].scaling.y = 750; newMeshes[0].scaling.z = 750; newMeshes[0].position.x = temp.posx; newMeshes[0].position.y = 0; newMeshes[0].position.z = temp.posz/2; newMeshes[0].rotate(BABYLON.Axis.X, Math.PI/4, BABYLON.Space.LOCAL); newMeshes[0].actionManager = new BABYLON.ActionManager(scene); newMeshes[0].checkCollisions = true; newMeshes[0].setPhysicsState({ impostor: BABYLON.PhysicsEngine.SphereImpostor, mass: 0 }); makeOverOut(newMeshes[0]); });};function calculateSunDistance(system,camera){ distancex = Math.abs((camera.target.x)-(system.getSunPositionX())); distancez = Math.abs((camera.target.z)-(system.getSunPositionZ())); console.log(distancex, " ",distancez); if ((distancex > system.getSunRange())||(distancez > system.getSunRange())){ system.setSun(system.getSunRange(),0); system.disposeLens(); console.log("desligou"); } else{ system.setSun(system.getSunRange(),1); system.activateLens(); console.log("ligou"); } };
  24. Well..... What can I say.... My brain just burned out or something. Lol...... Thanks for the feature.