Simulating Simple Clothing (like a skirt)

yoshin

06-08-2007 01:32:44

Hello.

Recently, I've been trying to put a skirt on a character mesh of mine. I got as far as making my skirt-mesh a cloth, importing it, and attaching the proper vertices to my character mesh's collision shape (which is a capsule, because it's a character controller). However, as I was working on this, I realized that it wouldn't work for a number of reasons.

First, the skirt-cloth collides with my character mesh's collision shape (the capsule), not the mesh itself (...which is obvious, but I didn't realize this until I saw it :oops: ). I figured I could just add more collision shapes to my character mesh (e.g. a capsule for each of the thighs), but then I realized that the collision shapes probably would not deform with the mesh when it animates, so this idea wouldn't work.

Also, because the skirt is attached to a collision shape, it doesn't turn when my character turns, it's a little off-sync with the character mesh, and it just glides around when the character mesh moves, instead of matching the up-and-down movements of the character mesh's walk-cycle. (Again, all this is understandable, and makes sense, but it's not what I want, and I can't figure out what I can do to get what I want.)

So, basically, it doesn't work at all, and at this point I'm wondering if it's possible at all to achieve what I want. Is there some way to make certain portions of a mesh cloth? That way, I could make the skirt part of my character mesh, and it would move, rotate, and deform according to my character, and not according to a collision shape. Or something, I don't even really know.

Any good techniques out there for what I'm trying to do?

Thanks.

Pottej

06-08-2007 11:08:07

I don't have much experience with cloths, but I'll try to help.

I would turn off collisions with the character controller completely, do this by going mCharacter->getNxController->setCollision(false)

This turns off collisions with the internal kinematic actor (i havent found them to be much use anyway). Alternatively you could use group masks or collision groups to stop just your cloth and the capsule colliding (best to see ageia docs).

Then I would make a shape that you want to approximate your character (out of primitives), use groups or masks to stop it colliding with your capsule controller again, and have it follow your character around every frame (set its global position and orientation every frame). Now you can attach your cloth to this character and it should be an OK approximation of the character.

This technique isnt that great however since it won't match your animations. If you want to get it right on with your animations then I would consider trying to attach the cloth the actual bones of your animation. You can offset from a bone with the Ogre::Tagpoint, and you could attach certain verts of your cloth to these tagpoints every frame. I dont know how youd get the physics engine to do this for you, so youd have to update to positions of the verts every frame (maybe a bad idea).

Sorry if both of these options are overkill, like I say I havent worked with cloths so may be missing the obvious solution.