Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Scaling / Sizing a cloth - How?
#2
(04-11-2017, 04:20 PM)csofrany Wrote: Hi there,
 
   I'm new to Obi in general, and just starting out with Obi Cloth. I have a scene where there are multiple differently sized items that I want to cover with pieces of cloth, to be uncovered later during runtime.

Now, in order to cover the different items, I'm using a simple plane that I add an Obi Cloth Component as outlined in the instructions. While this works in a general way, it seems to me that no matter what size of cloth i define (using the scale properties of the object's Transform), the resulting cloth expands/shrinks to the 1:1 scale as soon as I hit start, in effect negating any scale settings of the master Transform.

How do correctly size an Obi cloth so it stays at the size/scale I set? Do i have to create an appropriately sized mesh for each cloth, or can I use one mesh for all (as I'm doing now)?

Since this is a fairly basic issue, I assume I've missed an essential part of the manual - so any pointers appreciated.

Thanks,
ch  
Hi!

Setting the scale (or position, or rotation) of any deformable object (cloth, rope, slime, etc) makes no sense at all in the general case. Consider this:

- what's the "position" of the cloth? the average of its vertices? its center of mass? any arbitrary vertex we define as its center?
- what's the "scale" of a cloth? if you stretch it by pulling, has it increased its scale? if it clumps into a small ball, has it been scaled down? in what direction? with respect to what point?
- same goes for rotation... if we twist both ends of a cloth strip in opposite directions, has the cloth (as a whole) rotated counter or clockwise?

Unity (and the current 3D graphics paradigm) makes use of affine transforms, that preserve points, lines and planes (straight shapes in general). Deformable objects lack this, since they can change their shape in a way that cannot be described by a simple affine transform. So in Obi, the transform only affects the fixed (red) particles in your cloth, since they are the only ones that can be rigidly transformed (not simulated). The same applies to Unity cloth, or any other cloth simulator, as this is just how geometry works (at least in this universe Guiño )

However, you can scale, rotate or translate the space in which the deformable object is simulated. Enter local space simulation. This requires a separate solver for each cloth object however:

- Parent your cloth object under the ObiSolver transform's. This transform will define the simulation space for your cloth.
- Enable "simulate in local space" in the ObiSolver inspector.
- You can now scale, rotate and translate the ObiSolver transform, and the cloth simulated "inside" of it will behave as you expect it to.

An alternative to this would be generate a different topology asset for each different size of your cloth mesh (have you noticed that the topology inspector has a "scale" property?), but this has several disadvantages:

- If you have more that say, 2 o 3 sizes of the same mesh, it can be tedious to set up.
- You cannot change the cloth size at runtime.

All this reminds me of one famous quote:
"Do not try and bend the spoon, that's impossible. There is no spoon. Then you'll see that it is not the spoon that bends, it is only yourself."
It is not the cloth that you scale, but the space around it.
Reply


Messages In This Thread
Scaling / Sizing a cloth - How? - by csofrany - 04-11-2017, 04:20 PM
RE: Scaling / Sizing a cloth - How? - by josemendez - 04-11-2017, 04:40 PM
RE: Scaling / Sizing a cloth - How? - by csofrany - 04-11-2017, 05:16 PM