RobS Posted September 28, 2016 Share Posted September 28, 2016 Hi, Thought I'd pop this in here as it's my first post but it might require moving to bugs. I'm trying to toggle physics on and off for certain meshes, I've knocked together this simple demo which basically works: http://www.babylonjs-playground.com/#YLJVQ#2 On run the 10 planes drop on to the box, bounce around a bit then settle. All good. If you then click the scene it should go in to a physics paused state and the 10 planes reset themselves above the plane. Cannon is throwing an error here and so the 2nd to 10th plane slowly start sinking down. Error stems from line 68. If I use Oimo then the pause state works well however the unpaused physics motion is a bit mad so I'd prefer to stick with Cannon. So really, this leaves me with two questions. Is the way I'm changing the physics impostors the best way enable/disable physics? And, is this a bug in CannonJS? Cheers, Rob Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted September 28, 2016 Share Posted September 28, 2016 Ping @RaananW Quote Link to comment Share on other sites More sharing options...
RobS Posted September 28, 2016 Author Share Posted September 28, 2016 I believe I've sorted it: http://www.babylonjs-playground.com/#YLJVQ#4 if (pl.physicsImpostor){ scene.getPhysicsEngine().removeImpostor(pl.physicsImpostor); } To (surprisingly) remove the imposter rather than this route. pl.physicsImpostor = new BABYLON.PhysicsImpostor(pl, BABYLON.PhysicsImpostor.NoImpostor, scene); No Script errors from Cannon now. Cheers, Rob brianzinn 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted September 28, 2016 Share Posted September 28, 2016 Interesting feedback for @RaananW 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.