Pryme8 Posted March 12, 2016 Share Posted March 12, 2016 The first should have no problem. for some reason the ball always pushes through the slope about halfway down... it just started doing that once I made the curves more exaggerated. There has to be a work around for this anybody know of one? http://www.babylonjs-playground.com/#IXJQI#6 Quote Link to comment Share on other sites More sharing options...
RaananW Posted March 12, 2016 Share Posted March 12, 2016 Hi! I am enjoying your physics questions This is a limitation enforced by Cannon. The simplest solution would be... increase the sphere's size - http://www.babylonjs-playground.com/#IXJQI#9 , or create a thicker mesh. I didn't debug fully, but this usually happens due when the physics engine "misses" the next collision if it happens too fast. I will try debugging this further and see if there is a better solution (another would be to "thicken" the path you created with more points). Pryme8 1 Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted March 12, 2016 Author Share Posted March 12, 2016 This may be kinda a heavy question... but what direction should I start looking in for simulating "soft bodies" I was thinking of somehow grouping areas of vertices and making a object that tracks their velocity and other physical factors then somehow iterate though the groups of vertices updating the mesh to the forces being applied? So Im assuming then I would need to track the points and the indices, with the points being the elements that move and the indices being used for the surface spring calculations? Im not gonna get into it to much quite yet, but its on the white board... also wanna see something freakout? http://www.babylonjs-playground.com/#IXJQI#10 I dont think the system likes the idea of contact points. Quote Link to comment Share on other sites More sharing options...
RaananW Posted March 12, 2016 Share Posted March 12, 2016 Soft bodies are usually simulated using particles, or using a lot of linked sphere impostors. Theoretically you could place a sphere on each index of a mesh and connect them using a fixed constraint (for example cannon's distance constraint that keep bodies in a certain distance from one another). Those impostors will be "tracking" the mesh's indices without you needing to do anything. Cannon has a particles system (which can be seen in the cloth demo on cannon's website - http://schteppe.github.io/cannon.js/examples/threejs_cloth.html). I have yet to integrate the particles system, but as this is a cannon-only feature I will have to come up with a good solution for Oimo as well. I think this will be a part of the custom-body implementations I am about to release (the first would be a car. You saw the cannon car, here is Oimo's - http://raananweber.com/oimocar/) . One of the custom bodies will be a kind of "cloth" system that will be constructed from a plane with a certain number of subdivisions. But this is a dream at the moment. Pryme8 1 Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted March 12, 2016 Author Share Posted March 12, 2016 I might start working on it once I finish some other projects. I ask because for one of my demos I want to simulate rope physics, and I think the particle system might be a good solution for that. Also while I have you here is there a way to process blob meshs? for example if I generate a set of points with like a 3d perlin, and then only grab certain points, is there a way to convert that into a mesh without having to figure anything out but the points? Quote Link to comment Share on other sites More sharing options...
RaananW Posted March 12, 2016 Share Posted March 12, 2016 To the rope - this will require joints/constraints which already exist (you even have a spring constraint if using CannonJS). Will be documented soon I know I am repeating myself, but I really want to first finish all features before documenting. To your second question - you can create a mesh (using new Mesh(...)) and set its vertices and indices to the points you need. This will require you to also triangulate those points. I don't know the exact use-case, but this would be the easiest way to create a mesh from points. BUT! @jerome might be able to provide a better answer for that (or better - the math wizard will be helping you for sure ). I would however recommend you to start a new thread for that, since this will create confusion for future users that would read this Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted March 12, 2016 Author Share Posted March 12, 2016 Ok ive done ropes with the joint solution, so if that's what you recommend that's what Ill stick to! thanks [wheel1, wheel2, wheel3, wheel4].forEach(function(w) { w.physicsImpostor = new BABYLON.PhysicsImpostor(w, BABYLON.PhysicsImpostor.SphereImpostor, { mass: 10, friction: 4, restitution: 0.5, nativeOptions: { move: true } }); }) by the way this is beautiful script! RaananW 1 Quote Link to comment Share on other sites More sharing options...
jerome Posted March 13, 2016 Share Posted March 13, 2016 @Pryme8 for your blob mesh, ribbons may be the solution http://doc.babylonjs.com/tutorials/Parametric_Shapes http://doc.babylonjs.com/tutorials/Ribbon_Tutorial 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.