Jump to content

Early test - C++ Physic engine port (emscripten)


Samuel Girardin
 Share

Recommended Posts

Looks awesome. Nice job:)
 
Offtopic:
I have looked at the oimo.js terrain demo and it uses a lot of spheres to simulate the heightmap.
Visualized it looks like this:
MqsLglR.png
 
 
Translated to babylonjs it would be something like:

var groundMaterial = new BABYLON.StandardMaterial("ground", scene);            groundMaterial.diffuseTexture = new BABYLON.Texture("textures/earth.jpg", scene);            groundMaterial.wireframe = true;            BABYLON.Mesh.CreateGroundFromHeightMap("ground", "textures/worldHeightMap.jpg", 200, 200, 16, 1, 20, scene, false, function (ground) {            	ground.material = groundMaterial;            	var vertices = ground.getVertexBuffer(BABYLON.VertexBuffer.PositionKind)._data;            	var radius = 100;            	var sphere = BABYLON.Mesh.CreateSphere("Sphere0", 32, radius, scene);            	sphere.isVisible = false;            	for (var i = 0, j = 0, l = vertices.length; i < l; i++, j += 3) {            		var newInstanceSphere = sphere.createInstance("Sphere_" + i);            		newInstanceSphere.position.x = vertices[j];            		newInstanceSphere.position.y = vertices[j + 1] - (radius / 2);            		newInstanceSphere.position.z = vertices[j + 2];            		newInstanceSphere.isVisible = false; //true to see spheres            		newInstanceSphere.freezeWorldMatrix();            		newInstanceSphere.setPhysicsState(BABYLON.PhysicsEngine.SphereImpostor, {            			move : false,            			mass : 0,            			restitution : 0.6,            			friction : 0.7            		});            	}            });
Link to comment
Share on other sites

I'd like to be able to code this kind of engine.  As I already said I' m only the translator in this job. This engine is really well coded , platform independant. And the guys from emscripten are doing a really impressive job. After that, it's 'only' a question of 'pointers' between c++ port to js and ts/js files. Really interesting job.

Link to comment
Share on other sites

Read it agian.  "not not" means it is bullet

 

Double negatives are not valid statemnts in english. This is most likly a typo. Google "not not" and bullet physics. there is not a javascript version of bullet named "not not". The emscription of bullet into javascript is ammo.js. This is an un-named C++ physics engine. Sam has not mentioned which one specificially it is.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...