I’m trying to work on a mechanic that involves dynamically adjusting the gravity. What is the process of doing this? I added in a timeout to change the scene gravity using:
scene.gravity = new BABYLON.Vector3(0,0,0)
Here is the playground: https://playground.babylonjs.com/#Z8HTUN#508
Changing the gravity in that way doesn’t seem to change the gravity of physics objects. What am I missing here?
Directly assigning values is indeed invalid.
Is there a way to change the gravity after setting it initially?
Edit Nevermind I just looked at the playground, thanks!
Thanks but this looks identical to what I had in my first post and as mentioned you can’t assign the value directly like that. @musk’s solution worked with this:
scene.getPhysicsEngine().setGravity(new BABYLON.Vector3(0, 9.8, 0))