Jump to content

Stop Imposter from going through Mesh


Recommended Posts


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).

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.


Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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 ;)



Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...