Search the Community

Showing results for tags 'sphere'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Coding and Game Design
  • Frameworks
    • Phaser 3
    • Phaser 2
    • Pixi.js
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Website URL





Found 11 results

  1. I am sure the problem is already solved somewhere and well known but I can't find a working solution. I have a sphere with planes around it and I need those planes to be tangent to the sphere depending on its position. I have made a playground with my basic setup: You will see 2 solutions I tried but which are not working, one using path3D and one with basic math. Thank you, Pichou
  2. Hey guys, I have been trying to do this for awhile, and feel like I am almost there. I had been using Bezier Curves but it wasn't quite doing what I needed. I need to draw an arc made with lines between 2 points on the sphere, following the curve of the sphere. I think I am close on this playground but some of my math isn't right in the drawArcFromPoints function Anyone think they can take a look and tell me where I am going wrong?
  3. Hey, In my project I need to create a sphere with a height map, but I only found the function "CreateGroundFromHeightMap" in the babylonjs docs. It seems like there is not a function for spheres. Can anybody help me with that? Basicly I need the function "CreateSphereFromHeightMap".
  4. Hi, Here's an example of what I am trying to do: I should see my four corners appear around the sphere on the 2D canvas, but for whatever reason they do not show up in the correct spot. Thanks, -StarToaster
  5. SvenFrankson

    Spherical voxels

    Hi everyone, Here's my last BabylonJS project. It's a port of a previous one I had made with Unity. The concept is about Spherical Voxels. A sphere is divided in degenerated-squares, allowing to create a minecraft-like voxel terrain on it. You may try it here : And source code is available here : Have a nice day !
  6. I have recently started on a Babylon project, and I have been wanting to create a capsule physics impostor for my game. I found a test demo for Oimo.js that basically achieves what I want: compound test (capsule). There are two problems: 1. due to some shortcomings in Oimo, I have had to switch to Cannon.js. 2. the demo uses Three.js and I'm sure how to exactly translate that into Babylon. I basically want to be able to combine two sphere impostors with a cylinder impostor. I'm not sure what is the best method for this, there are only a few examples that I have found, and I haven't found anything in the docs. So I created an example to show what I am talking about: capsule sandbox. I have created the capsule mesh, but I just need to figure out how to add a capsule impostor. Thanks.
  7. Why ? var rawVerts = object.getVerticesData ? object.getVerticesData(BABYLON.VertexBuffer.PositionKind) : []; var rawFaces = object.getIndices ? object.getIndices() : []; BABYLON.Tools.Warn("MeshImpostor only collides against spheres."); returnValue = new CANNON.Trimesh(rawVerts, rawFaces); Even tho CannonJS supports mesh/plane collision ? : Demo : Source : // ground plane var groundShape = new CANNON.Plane(); var groundBody = new CANNON.Body({ mass: 0, position: new CANNON.Vec3(0,0,-5) }); groundBody.addShape(groundShape); world.addBody(groundBody); demo.addVisual(groundBody); Edit: Ok, I overlooked the fact that the Mesh impostor is infact a Trimesh shape ( So can you add ConvexPolyhedron shapes in the next release please ?
  8. Hi guys, i tried to use the update function from an older forum post to edit the size of my bounding box. Somehow the bounding box didn't change. Link: Any ideas?
  9. Hi All, I'm working on something I'd like for my project; specifically I want to nest one mesh inside another and have collision detection (e.g. like the dice in a dome in the trouble board game ). I've read all the physics related tutorials for cannon and Oimo, seemed to get further (not far) with Oimo; so sticking with that so far. Have also looked at all of the relevant demos I could find. I have a playground which illustrates the efforts I've made so far: As you'll see; gravity affects the cube. However I'd like the cube to stop when it collides with the sphere; so it never leaves the sphere. I'd like the sphere to remain static (or at least not move) which is why i've set its mass to 0 per the tutorials. Eventually if I shake the sphere, the cube would bounce around inside the sphere (first things first). Any advice would be greatly appreciated!
  10. Please find my multi texture sphere implementation at Now I would like add actions to each of the colors in the sphere, or simply adding event handler with each sub meshes. But its not working. for(i=0;i<data.length;i++){ var currentRowSize = Math.round(data[i] * individualOffset) * rowSize; // Just adding remaing space to last item if(i == data.length-1){ currentRowSize = rowCount*rowSize - prevRowSize; } submeshes[i] = new BABYLON.SubMesh(i+1, 0, verticesCount, prevRowSize,currentRowSize , sphere); prevRowSize+= currentRowSize; sphere.subMeshes.push(submeshes[i]); submeshes[i].actionManager = new BABYLON.ActionManager(scene); submeshes[i].actionManager.registerAction(new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPickTrigger, function(e){ console.log(e); })); }How can this can be implemented ? Please let us know your thoughts
  11. The testscene simulate the situation, where the ball never stop!? I think we can solve it with the Brownian Motion in intensity and tween or easing type, 3dDemo More infos: Testscene: <!DOCTYPE html><html xmlns=""><head><title>BABYLON - physics</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"> <link rel="stylesheet" href="lib/css/babylon.css"> <script src="lib/js/babylon.1.9.0.js"></script> <script src="lib/js/hand.js"></script> <script src="lib/js/stats.js"></script> <script src="lib/js/cannon.js"></script> <script type="text/javascript">window.onload=function(){ this.canvas = document.getElementById("webgl"); if (!BABYLON.Engine.isSupported()){window.alert('Your browser do not support WebGL'); }else{ var engine = new BABYLON.Engine(canvas,true); scene = createScene(engine); scene.activeCamera.attachControl(canvas); engine.runRenderLoop(function(){ scene.render(); stats(scene,"stats"); // call the statistics }); this.addEventListener("resize", function () { engine.resize(); }); } };var createScene= function (engine){ var scene = new BABYLON.Scene(engine); var camera = new BABYLON.FreeCamera("Camera", new BABYLON.Vector3(0, 3, -40), scene); camera.position.y = -12; camera.checkCollisions = true; camera.applyGravity = true; var light = new BABYLON.DirectionalLight("dir02", new BABYLON.Vector3(0.2, -1, 0), scene); light.position = new BABYLON.Vector3(0, 80, 0); var materialAmiga = new BABYLON.StandardMaterial("amiga", scene); materialAmiga.diffuseTexture = new BABYLON.Texture("lib/media/amiga.jpg", scene); materialAmiga.emissiveColor = new BABYLON.Color3(0.5, 0.5, 0.5); materialAmiga.diffuseTexture.uScale = 5; materialAmiga.diffuseTexture.vScale = 5; var materialAmiga2 = new BABYLON.StandardMaterial("amiga", scene); materialAmiga2.diffuseTexture = new BABYLON.Texture("lib/media/ground.jpg", scene); materialAmiga2.emissiveColor = new BABYLON.Color3(0.5, 0.5, 0.5); var box = BABYLON.Mesh.CreateBox("Box", 10, scene); box.position.x = -8; box.material = materialAmiga2; box.rotationQuaternion = BABYLON.Quaternion.RotationYawPitchRoll(0, .21, .43); var sphere = BABYLON.Mesh.CreateSphere("Sphere", 9, 10.0, scene); sphere.position.x = 6; sphere.material = materialAmiga; var ground = BABYLON.Mesh.CreatePlane("Plane", 164.0, scene); ground.material = materialAmiga2; ground.position.y = -30; ground.rotationQuaternion = BABYLON.Quaternion.RotationYawPitchRoll(0, Math.PI/2, 0); // Physics scene.enablePhysics(); scene.setGravity(new BABYLON.Vector3(0, -98.1, 0)); sphere.setPhysicsState({ impostor: BABYLON.PhysicsEngine.SphereImpostor, mass: 1, }); box.setPhysicsState({ impostor: BABYLON.PhysicsEngine.BoxImpostor, mass: 5 }); ground.setPhysicsState({ impostor: BABYLON.PhysicsEngine.BoxImpostor, mass: 0, friction: 1, restitution: 0.1 }) return scene; };</script></head><body> <canvas id="webgl"></canvas></body></html>