Robin Posted October 25, 2017 Share Posted October 25, 2017 Background: I am reading the Babylon.js ebook - Chapter9 Collision, and find a line of code: var body = mesh.setPhysicsState(BABYLON.PhysicsEngine.BoxImpostor, {mass:0, restituion:0.5, friction:0.5}); This function will return an instance of the rigid body, i.e. Oimo.Body. However, I run the code, and an error is raised, says the function setPhysicsState is undefined. Question 1: Is that true the function is removed from API forever? Question 2: Once physics impostor is added to a mesh, e.g. sphere.physicsImpostor = new BABYLON.PhysicsImpostor(...), how can I move this mesh? Do I have to apply an impulse to the mesh or I can simply update the mesh position, such as sphere.positon.z += 1? Thank you. Quote Link to comment Share on other sites More sharing options...
Raggar Posted October 25, 2017 Share Posted October 25, 2017 1) Yes. The API has changed to: sphere.physicsImpostor = new BABYLON.PhysicsImpostor(sphere, BABYLON.PhysicsImpostor.SphereImpostor, { mass: 1, restitution: 0.3 }, scene); 2) You can do both. But physics-engines prefer forces or impulses. You Can change the positions, but you "might" get into various issues with clipping through objects and the sorts. RaananW, HoloLite and Temechon 3 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.