Gamerazor

Members
  • Content Count

    17
  • Joined

  • Last visited

About Gamerazor

  • Rank
    Member
  • Birthday 06/18/1985

Contact Methods

  • Twitter
    promodominus
  • Skype
    promodominus

Profile Information

  • Gender
    Male
  • Location
    Spain
  • Interests
    3D game engines, Webgl, Blender, frontend develop
  1. how can i return any data from BABYLON.SceneLoader.ImportMesh? for example: BABYLON.SceneLoader.ImportMesh('Box', '../assets/', 'box.babylon', Balltingo, function(newMeshes) { var box, boxClone, col, i, row, separate, x, y, z; box = newMeshes[0]; x = -8; y = 1.9; z = -6; box.position = new BABYLON.Vector3(x, y, z); box.setPhysicsState(BABYLON.PhysicsEngine.BoxImpostor, { mass: 1000 }); row = 0; boxClone = []; col = 0; i = 0; separate = 2; while (row < 3) { while (col < 4) { z = z + 3; boxClone[i] = box.clone("boxClone" + col); boxClone[i].position = new BABYLON.Vector3(x, y, z); boxClone[i].setPhysicsState(BABYLON.PhysicsEngine.BoxImpostor, { mass: 1000 }); boxClone[i].checkCollisions = true; col++; i++; } z = -6; x = x + 4; if (row < 2) { boxClone[i] = box.clone("boxClone" + row); boxClone[i].position = new BABYLON.Vector3(x, y, z); boxClone[i].setPhysicsState(BABYLON.PhysicsEngine.BoxImpostor, { mass: 1000 }); boxClone[i].checkCollisions = true; } col = 0; row++; i++; } i = 0; });i want return the boxClone array to use in other functions some example please. Thanks!
  2. Gamerazor

    How i can detected collisions with Oimjs

    Thank you Wingnut the first example is useful. It resolve my problem. Thank you.
  3. Gamerazor

    How i can detected collisions with Oimjs

    ok, but how can get when the bar collide with the ball? That tutorial only explains to get the mesh when pick in it. can you tell me any example with my case, please? thanks
  4. Hello. I have seen in other post that oimjs doesn't detect collisions and this is a big problem for tha game that I'm doing that is similar to Arkanoid but in 3D. I need impulse the ball when collide with the bar and need detect when the ball collide with some box for it disappears. How can I resove this problem? Is there any alternative with oimjs to detect collisions?
  5. Gamerazor

    Problem with physics

    thank you wingnut but i only had problem when the bar collided with the left wall but I have resolved this problem with this way: move = (body,barra) -> s= 2.5 if body.moveLeft && barra.position.z > -5 barra.applyImpulse(new BABYLON.Vector3(0,0,-s),barra.position) else if body.moveRight barra.applyImpulse(new BABYLON.Vector3(0,0,s),barra.position) body.body.linearVelocity.scaleEqual(0.92) body.body.angularVelocity.scaleEqual(0) return
  6. Gamerazor

    Problem with physics

    ok the problem is resolved with: barra = Balltingo.getMeshByID("Bar") body = barra.setPhysicsState(BABYLON.PhysicsEngine.BoxImpostor,{mass: 1000, friction: 0.00001, restitution:0.00001}) move = (body,barra) -> s= 2 if body.moveLeft barra.applyImpulse(new BABYLON.Vector3(0,0,-s),barra.position) else if body.moveRight barra.applyImpulse(new BABYLON.Vector3(0,0,s),barra.position) body.body.linearVelocity.scaleEqual(0.92) body.body.angularVelocity.scaleEqual(0) return #this is coffescript
  7. Gamerazor

    Problem with physics

    then how can i resolve this problem? because the ball needs the physics engine and the bar needs collide with the ball.
  8. Gamerazor

    Problem with physics

    but, won't the bar bounce forward?
  9. Gamerazor

    Problem with physics

    Hello Im doing the game like arkanoid. The problem is when I try to move the bar with physics. When the bar has collided with the wall it lose the path and don't move straight to left to right. When I also try with moveWithCollisions() it works bad when the bar collide with the ball. How can I resolve this?
  10. I'm doing a game like arkanoid. I want to move the bar with my keywords. how can i do that?
  11. Gamerazor

    I have problem with multitexture

    Finaly, I resolve the problem although I don't understand very well that but I will study it in other moment because often I export the meshes with the textures from blender. Thank you Wingnut and Deltakosh. function createSceneTuto(engine){ var scene = new BABYLON.Scene(engine); //scene.fogMode = BABYLON.Scene.FOGMODE_EXP; //scene.fogDensity = 0.07; //scene.fogColor = new BABYLON.Color3(0.25,0.8,0.3); var camera = new BABYLON.ArcRotateCamera("camara",-20,-45,35, new BABYLON.Vector3.Zero(),scene); var luz = new BABYLON.HemisphericLight("Sol", new BABYLON.Vector3(-10,150,0),scene); luz.diffuse = new BABYLON.Color3(0.6,0.7,1); luz.intensity = 0.5; var entorno = new BABYLON.Mesh.CreateBox("Entorno",400,scene); var entornoMaterial = new BABYLON.StandardMaterial("skyBox",scene); entornoMaterial.backFaceCulling = false; entornoMaterial.reflectionTexture = new BABYLON.CubeTexture("../skybox/skybox",scene); entornoMaterial.reflectionTexture.coordinatesMode = BABYLON.Texture.SKYBOX_MODE; entornoMaterial.diffuseColor = new BABYLON.Color3(0,0,0); entornoMaterial.specularColor = new BABYLON.Color3(0,0,0); entorno.material = entornoMaterial; var cubo = new BABYLON.Mesh.CreateBox("Cubo",10,scene); cubo.position.y = 10; var esfera = new BABYLON.Mesh.CreateSphere("Esfera",10,8,scene); var espejo = new BABYLON.StandardMaterial("texturaEspejo",scene); esfera.position = new BABYLON.Vector3(-15,10,0); suelo = new BABYLON.Mesh.CreateGround("tierra",200,200,2,scene,false); piedras = new BABYLON.StandardMaterial("Piedras",scene); piedras.bumpTexture = new BABYLON.Texture("../materiales/piedras.jpg",scene); rocas = new BABYLON.StandardMaterial("Rocas",scene); rocas.diffuseTexture = new BABYLON.Texture("../materiales/roca.png",scene); madera = new BABYLON.StandardMaterial("Plata",scene); madera.diffuseTexture = new BABYLON.Texture("../materiales/madera_gris.jpg",scene); multimat = new BABYLON.MultiMaterial("multi", scene); multimat.subMaterials.push(rocas); multimat.subMaterials.push(piedras); multimat.subMaterials.push(madera); esfera.subMeshes = []; var verticesCount = esfera.getTotalVertices(); esfera.subMeshes.push(new BABYLON.SubMesh(0,0, verticesCount,0,300,esfera)); esfera.subMeshes.push(new BABYLON.SubMesh(1,0, verticesCount,300,600,esfera)); esfera.subMeshes.push(new BABYLON.SubMesh(2,0, verticesCount,600,1125,esfera)); esfera.material = multimat; pelicula = new BABYLON.StandardMaterial("Pelicula",scene); pelicula.diffuseTexture = new BABYLON.VideoTexture("Sintel",["../textures/sintel.ogv"],256,scene,true); pelicula.emissiveColor = new BABYLON.Color3(1,1,1); suelo.material = pelicula; espejo.reflectionTexture = new BABYLON.MirrorTexture("espejo",512,scene,true); espejo.reflectionTexture.mirrorPlane = new BABYLON.Plane(1,-1.0,10,-10.0); espejo.reflectionTexture.renderList = [esfera,suelo]; cubo.material = espejo; return scene;}
  12. Hello everybody, when I render this code, it doesn't show all sphere multitexture, only shows the first texture: function createSceneTuto(engine){ var scene = new BABYLON.Scene(engine); var camera = new BABYLON.ArcRotateCamera("camara",-20,-45,35, new BABYLON.Vector3.Zero(),scene); var luz = new BABYLON.HemisphericLight("Sol", new BABYLON.Vector3(-10,150,0),scene); luz.diffuse = new BABYLON.Color3(0.6,0.7,1); luz.intensity = 0.5; var cubo = new BABYLON.Mesh.CreateBox("Cubo",10,scene); cubo.position.y = 10; var esfera = new BABYLON.Mesh.CreateSphere("Esfera",10,8,scene); var espejo = new BABYLON.StandardMaterial("texturaEspejo",scene); esfera.position = new BABYLON.Vector3(-15,10,0); suelo = new BABYLON.Mesh.CreateGround("tierra",200,200,2,scene,false); piedras = new BABYLON.StandardMaterial("Piedras",scene); piedras.bumpTexture = new BABYLON.Texture("../materiales/piedras.jpg",scene); rocas = new BABYLON.StandardMaterial("Rocas",scene); rocas.diffuseTexture = new BABYLON.Texture("../materiales/roca.png",scene); madera = new BABYLON.StandardMaterial("Plata",scene); madera.diffuseTexture = new BABYLON.Texture("../materiales/madera_gris.jpg",scene); multimat = new BABYLON.MultiMaterial("multi", scene); multimat.subMaterials.push(rocas); multimat.subMaterials.push(piedras); multimat.subMaterials.push(madera); esfera.subMeshes = []; var verticesCount = esfera.getTotalVertices(); esfera.subMeshes.push(new BABYLON.SubMesh(0,0, verticesCount,0,900,esfera)); esfera.subMeshes.push(new BABYLON.SubMesh(1,0, verticesCount,900,1800,esfera)); esfera.subMeshes.push(new BABYLON.SubMesh(2,0, verticesCount,1800,2088,esfera)); esfera.material = multimat; pelicula = new BABYLON.StandardMaterial("Pelicula",scene); pelicula.diffuseTexture = new BABYLON.VideoTexture("Sintel",["../textures/sintel.ogv"],256,scene,true); pelicula.emissiveColor = new BABYLON.Color3(1,1,1); suelo.material = pelicula; espejo.reflectionTexture = new BABYLON.MirrorTexture("espejo",512,scene,true); espejo.reflectionTexture.mirrorPlane = new BABYLON.Plane(1,-1.0,10,-10.0); espejo.reflectionTexture.renderList = [esfera,suelo]; cubo.material = espejo; return scene;}This is the image:
  13. Gamerazor

    I have problem with the texture video

    but I put camera.avi and it is supported. It work.
  14. Gamerazor

    I have problem with the texture video

    Thank you Wingnut for the example that you showed me. Now it run very well. This is my code finaly: if(BABYLON.Engine.isSupported()){ var canvas = document.getElementById("renderCanvas"); var engine = new BABYLON.Engine(canvas,true); var scene = new BABYLON.Scene(engine); var camera = new BABYLON.ArcRotateCamera("Camara",0,0,10,BABYLON.Vector3.Zero(),scene); var light = new BABYLON.PointLight("Luz", new BABYLON.Vector3(20,100,2),scene); var cubo = new BABYLON.Mesh.CreateBox("cubo",1.0,scene); var tv = new BABYLON.Mesh.CreatePlane("tv",100,scene); tv.position.y = -3; tv.rotation.x = Math.PI / 2; tv.material = new BABYLON.StandardMaterial("tv_mat",scene); tv.material.emissiveColor = new BABYLON.Color3(1,1,1); tv.material.backFaceCulling = 1; tv.material.diffuseTexture = new BABYLON.VideoTexture("vid",["../video/camera.avi"],512,scene,false); camera.setPosition(new BABYLON.Vector3(0,1,3)); camera.attachControl(canvas); material = new BABYLON.StandardMaterial("default",scene); material.emissiveColor = new BABYLON.Color3(0.3,0.3,0.3); var dynamicTexture = new BABYLON.DynamicTexture("dynamic texture",512,scene,true); dynamicTexture.hasAlpha = true; material.diffuseTexture = dynamicTexture; cubo.material = material; var count = 0; scene.beforeRender = function(){ var textureContext = dynamicTexture.getContext(); var size = dynamicTexture.getSize(); var text = count.toString(); textureContext.save(); textureContext.fillStyle = "red"; textureContext.fillRect(0,0,size.width,size.height); textureContext.font = "bold 120px Calibri"; var textSize = textureContext.measureText(text); textureContext.fillStyle = "white"; textureContext.fillText(text,(size.width - textSize.width)/2,(size.height - 120 )/2); textureContext.restore(); dynamicTexture.update(); count++; }; var renderLoop = function(){ engine.beginFrame(); scene.render(); engine.endFrame(); BABYLON.Tools.QueueNewFrame(renderLoop); }; BABYLON.Tools.QueueNewFrame(renderLoop);}
  15. I can't load a video texture. This is my code: if(BABYLON.Engine.isSupported()){ var canvas = document.getElementById("renderCanvas"); var engine = new BABYLON.Engine(canvas,true); var scene = new BABYLON.Scene(engine); var camera = new BABYLON.ArcRotateCamera("Camara",0,0,10,BABYLON.Vector3.Zero(),scene); var light = new BABYLON.PointLight("Luz", new BABYLON.Vector3(20,100,2),scene); var cubo = new BABYLON.Mesh.CreateBox("cubo",1.0,scene); camera.setPosition(new BABYLON.Vector3(0,1,3)); camera.attachControl(canvas); material = new BABYLON.StandardMaterial("default",scene); material.emissiveColor = new BABYLON.Color3(0.3,0.3,0.3); var dynamicTexture = new BABYLON.DynamicTexture("dynamic texture",512,scene,true); dynamicTexture.hasAlpha = true; material.diffuseTexture = dynamicTexture; cubo.material = material; var ecran = scene.getMeshByName("Ecran"); ecran.material.diffuseTexture = new BABYLON.VideoTexture("video",["video/camera.avi"],256,scene,true); var count = 0; scene.beforeRender = function(){ var textureContext = dynamicTexture.getContext(); var size = dynamicTexture.getSize(); var text = count.toString(); textureContext.save(); textureContext.fillStyle = "red"; textureContext.fillRect(0,0,size.width,size.height); textureContext.font = "bold 120px Calibri"; var textSize = textureContext.measureText(text); textureContext.fillStyle = "white"; textureContext.fillText(text,(size.width - textSize.width)/2,(size.height - 120 )/2); textureContext.restore(); dynamicTexture.update(); count++; }; var renderLoop = function(){ engine.beginFrame(); scene.render(); engine.endFrame(); BABYLON.Tools.QueueNewFrame(renderLoop); }; BABYLON.Tools.QueueNewFrame(renderLoop);}I put this as tutorial says: var ecran = scene.getMeshByName("Ecran"); ecran.material.diffuseTexture = new BABYLON.VideoTexture("video",["video/camera.avi"],256,scene,true);but i get this error: TypeError: 'null' is not an object (evaluating 'ecran.material')