28-04-2018, 09:26 PM
(20-04-2018, 08:59 AM)josemendez Wrote: Deformable objects (cloth, ropes, fluid) cannot be transformed directly at runtime (translated, rotated, or scaled). Not Obi's limitation, it's just a fundamental consequence of how transform math works: scaling is an affine transformation, and works relative to a reference point, or center. A deformable piece of cloth (or any other non-rigid object) has no clearly defined "center", so it cannot be transformed.
When you transform a cloth, only its fixed particles will be scaled (as they are statically attached to the object's frame) and the rest of the cloth simulation will just follow their new shape, stretching or compressing where needed. If no particles are fixed, transforming the cloth will have no effect at all. Unity's default cloth works the same way.
There's one workaround though: if you simulate the cloth in local space, you can transform the space in is simulated in instead. This will result in a more traditional scaling behavior. To do this, enable "simulate in local space" in the ObiSolver, parent the cloth under the solver, then scale/rotate/translate the solver itself.
Now, regarding the initial scale of your objects and your export/import workflow, Unity's mesh importer has a "scale factor" option specifically designed for this: it sets the actual scale at which your mesh is imported, and this size is regarded as its "rest" size (their size when the transform's scale is set to 1,1,1)
You should also strive to model your meshes -and your entire scene- using real-world units. This is extremely important when working with physics. 1 Unity unit = 1 meter, as fas as the physics engine is regarded. If you set your modeling package's units to meters, you will be able to use a scale factor of 1 in Unity's import options. If you set them to centimeters, you'll have to use a scale factor of 0.01, etc. See "using the right size":
https://docs.unity3d.com/Manual/class-Rigidbody.html
Do not change the size of your objects by altering their transform's scale in editor, this is generally regarded as bad practice and will make it very difficult to get relative sizes of different objects in your scene right. You should only use transform scaling when making an object bigger or smaller than its natural size in your game's world.
kind regards,
Thank you for this detailed response. I typically don't do much with physics in Unity beyond basic rigidbodies so this has been illuminating.