carringtonW84 Posted December 7, 2014 Share Posted December 7, 2014 Hi ! I'm starting with BabylonJS: for information I know simulate the solar system and simulate a bouncing ball in a closed room.Now I would like to simulate a simple gear with two wheels but I do not know where to start ... Could you give me the method to make this simulation and what features should be used? Thank you in advance and good evening Quote Link to comment Share on other sites More sharing options...
carringtonW84 Posted December 14, 2014 Author Share Posted December 14, 2014 Hi, I'm still thinking about my problem: - I drew a wheel with Blender - I imported and duplicated this wheel with BabylonJS Now the black wheel turns as you can see below: http://www.hostingpics.net/viewer.php?id=49727049ss.png But I miss two things: - Add a constraint on the Y axis of the red wheel - That the two wheels do not cross. Someone to help me ?Thanks a lot ! Quote Link to comment Share on other sites More sharing options...
julien-moreau Posted December 15, 2014 Share Posted December 15, 2014 According to the gears possible theories, you can apply a rotation on both gears but not a the same speedLike :scene.registerBeforeRender(function () { theBigGear.rotation.y += 0.02; theLessBigGear.rotation.y += 0.04;});Or if you love mathematics : http://www.codecogs.com/library/engineering/theory_of_machines/the-geometry-of-gears.php ^^ Quote Link to comment Share on other sites More sharing options...
carringtonW84 Posted December 15, 2014 Author Share Posted December 15, 2014 Thanks Luaacro !But the mathematics aren't my problem... I was initially turn the two wheels but it's not a real gear BABYLON.SceneLoader.ImportMesh("", "scenes/", "wheel4.babylon", scene, function (newMeshes) { camera.target = newMeshes[0]; wheel1 = newMeshes[0]; wheel1.position = new BABYLON.Vector3(0, 0, 0); wheel1.material = materialRed; //wheel1.setPhysicsState(BABYLON.PhysicsEngine.BoxImpostor, {mass:0, friction:0.5, restitution: 4}); wheel2 = wheel1.clone("wheel2"); wheel2.position = new BABYLON.Vector3(5.3, 0, 0); wheel2.material = materialBlack; //wheel2.setPhysicsState(BABYLON.PhysicsEngine.BoxImpostor, {mass:0, friction:0.5, restitution: 4}); scene.registerBeforeRender(function () { wheel1.rotate(new BABYLON.Vector3(0, 1, 0) , 0.01, BABYLON.Space.LOCAL); //wheel2.rotate(new BABYLON.Vector3(0, 1, 0) , -0.01, BABYLON.Space.LOCAL); });});If you run my project, you will see that the red wheel crosses the black wheel so now I want: - That the two wheels are "solid" (do not cross) - Add a constraint on the Y axis to the black wheel Thus the black wheel will turn because of the red wheel. Below the link to download my project :http://1drv.ms/1AzSZpX Thank you ! Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted December 17, 2014 Share Posted December 17, 2014 Why not creating compound meshes? To try to create a gear from boxes? Quote Link to comment Share on other sites More sharing options...
carringtonW84 Posted December 18, 2014 Author Share Posted December 18, 2014 Yes exactly, just for fun... 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.