Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Initialize a softbody on scaled objects via script
#2
(23-08-2019, 08:24 AM)aznaf Wrote: Imagine I have a skinned mesh object and it is scaled by its bones, is there a way to initialize & bind skin (using its current shape) from scripts?

Bone scaling is not supported. Well, it is, but won't act as you expect it to.

Suppose you scale a bone to double its size (scale <2,2,2>). Scaling a bone acts upon the mesh vertex positions after skinning is done each frame. However, the shared mesh (used to generate the topology, and the cloth asset) is not affected in any way by this. So skin constraints are constraining the cloth to the scaled/skinned mesh vertex positions, but all other constraints (distance, bend, etc) still work with the unscaled mesh. The end result would overstretch all constraints to double its rest length.

For this to work you'd have to bake bone scale onto the shared mesh vertices, freeze bone scale to 1 (so that the "doubled size" becomes its natural size), then generate the topology, and reinitialize the cloth. This is quite complex but could be done. The first two steps don't have anything to do with Obi. Generating a topology and reinitializing at runtime can be done. See the included "RuntimeCloth" sample scene and its associated scripts.
Reply


Messages In This Thread
RE: Initialize a softbody on scaled objects via script - by josemendez - 23-08-2019, 09:57 AM