A script for clothes not worn
Speculativism
Posts: 90
Please. Maybe from Code 66 or Riversoft Art?
A script which would be applied to any piece of clothing to do one of 3 things:
1) Be laid out flat
2) Be hung on a coat hanger
3) Be rolled up in ball and thrown on the floor
Post edited by Speculativism on
Comments
That isn't soemthing a script could do, unless there were standard morphs for those features.
Oh well, I can dream anyway.
I suppose There may be workarounds.
I could probably lay the clothing out flat using existing scale and transform sliders, roll the clothes up in a ball using D-Form perhaps.
Hanging the clothes up is probably the tricky one. Maybe could be done by pinning it in place and then using D-Force gravity simulation?
I was just thinking that all of these could be automated with a code.
I am sure it's possible for someone, but I do know my scripting ability is inadequate, and the problem is not insignificant.
For a shirt on a hangar the script would need to consider the following:
It is possible for scripts to access the vertex positions of a model, and also the normals (if not accessible in the model they can be calculated). As a majority of clothing has normals pointing outward, this convention makes it easier to program what to do with the facet and where it's assumed to fall. Facets close to the centreline will have little Z direction component to the normal, so can form the hinge by which the cloth is flattened. These facets will move out sideways a bit. As the front & back move more in line with the Z=0 plane, a random curtain style ripple could be added to the destination point of the facets to preserve the apparent width of fabric used. And possibly the vertices could be moved down a bit to keep the length of fabric appearing constant.
As I said, the problem is not insignificant.
To fold clothes, you'd need to flatten it as per being on a hanger, and then fold the clothing in pre-defined positions. Again possible, but less than easy.
Also, after the script, that instance of the article of clothing would not be capable of being used as a garment again.
Regards,
Richard
Layng out flat and hanging on a hanger might both be achieved with dforce. If it's actual dforce clothing (as opposed to normal clothes with a dforce modifier applied), you might need to override any dforce weight mapping first.