AlbertoBonn Posted April 2, 2014 Share Posted April 2, 2014 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 typehttp://easings.net/en,http://www.greensock.com/gsap-js/3dDemoMore infos:http://de.wikipedia.org/wiki/1/f%C2%B2-Rauschenhttp://en.wikipedia.org/wiki/Brownian_noisehttp://en.wikipedia.org/wiki/Brownian_motion Testscene:<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><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> Quote Link to comment Share on other sites More sharing options...
Wingnut Posted April 3, 2014 Share Posted April 3, 2014 Hi I do not know if Stefan Hedman, author of cannon.js physics engine reads this forum. He has not made it obvious that he does, but maybe. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 3, 2014 Share Posted April 3, 2014 Yes I suggest posting your question on cannon.js site:http://www.cannonjs.org/ Quote Link to comment Share on other sites More sharing options...
AlbertoBonn Posted April 4, 2014 Author Share Posted April 4, 2014 hhhhmmmm... thats right! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.