Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Improving collisions and self collisions
#10
(22-08-2017, 07:09 PM)Pr0fitt3R Wrote: Yeah, I realised this!  Gran sonrisa


As I said before, It would be extremely usefull if I were able to freeze/unfreeze parts of the rope. But I though it would be possible only after the shape-matching constraints update. How can I do that thing with the vertices? Are there any documentation about it, any example?  Huh


Thanks (one more time, lol) in advance, Jose!

Hi!

Well, if the rope is parented to the coil, fixing rope particles (i.e, setting their inverse mass to 0) would have the effect you want: they'd follow the rope transform, and by extension (because of parenting) the coil transform. They'd be frozen in the coil transform's local space. So when the coil rotates/translates, they'd move with it. Unfixed particles would still be simulated as usual.

So you could determine which particles to fix (by distance to the coil, or some other method) and then fix them. See http://obi.virtualmethodstudio.com/tutor...icles.html for an example on how to fix particles in place programmatically. 

This method (fixing particles close to the coil) would not require building your own mesh to fake the amount of coiled rope. The particles would still be there, but wouldn´t need to generate any collisions between them because they'd be fixed.

The other method I proposed in the previous post basically involves using the ObiRopeCursor component the extend/retract the rope dynamically, similar to the "Crane" sample scene included with Obi. Place it near the coil so that the rope gives the impression of coming out of the coil. Right where the rope meets the coil, append/remove vertices to/from a mesh that represents the coil itself. I think this video (AgX dynamics, an engineering-grade simulator) will make it clearer:



As you can see around 0:28, the coil itself is a simple static mesh (see the wireframe in green). Only the "free" part of the rope is simulated using particles. When the coil retracts the rope, particles disappear (this is handled by ObiRopeCursor) and you'd add a new loop of vertices to the coil mesh. When the coil extends the rope, reverse the process: mesh loops disappear from the coil, as new particles are created by the ObiRopeCursor.  

This method is slightly more complex to implement, but has the advantage that it uses much less particles. You´d be able to wind up as much rope as you'd like with barely any performance hit (rendering meshes is very cheap compared to simulating physics).

You'd only have to manage the addition/removal of mesh loops to the coil. Take a look at Unity's "Mesh" class for more info on how to modify a mesh at runtime: 
https://docs.unity3d.com/ScriptReference/Mesh.html
Reply


Messages In This Thread
RE: Improving collisions and self collisions - by josemendez - 22-08-2017, 07:28 PM