Myjestic Posted March 31, 2016 Share Posted March 31, 2016 Hi together. I toke a look at David Rousset QR Maze and tried to understand how babylon.js works and tried to optimize some code. I came across some strange behavior with the gravity property. scene.enablePhysics(new BABYLON.Vector3(0, 0, 0)); scene.gravity = new BABYLON.Vector3(0, -0.8, 0); scene.collisionsEnabled = true; As you can see, the gravitiy in ground direction is set to -0.8. If I walk through the maze gravity is working. I am on 55fps. If I look onto the ground and move backwards nothing happens. So it should be, I am working on a laptop and can switch it to low power consumption. The CPU and GPU than works on less power. The frame rate drops to 25 fps. Now if I do the some like mentioned above (looking down and walking back) and I am flying away from the ground. The question is, why low fps affects the gravity of the scene? If I set the gravity to -10 everthing is okay on both fps situations. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted April 1, 2016 Share Posted April 1, 2016 Did you try like this and see if it's better: scene.enablePhysics(new BABYLON.Vector3(0, -0.8, 0)); scene.collisionsEnabled = true; The first parameter of enablePhysics is gravity Quote Link to comment Share on other sites More sharing options...
Myjestic Posted April 1, 2016 Author Share Posted April 1, 2016 If you'd ever get anything right, it would work. Thanks a lot Dad72. Quote Link to comment Share on other sites More sharing options...
RaananW Posted April 1, 2016 Share Posted April 1, 2016 I like wondering out loud. In this case I wonder - how would the physics gravity, which you don't need in your case, affect the collision gravity? They are two different systems. Care to share your scene? Or a simplified version of it? Quote Link to comment Share on other sites More sharing options...
Myjestic Posted April 1, 2016 Author Share Posted April 1, 2016 You can find the complete code under this Link. The scenery is build in file ../scripts/coding4fun.js 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.