View Full Version : Flowing clothing?
billysson
01-05-2010, 06:08 PM
I'm modeling a character with loose clothing. Mostly excess fabric from a long skirt and a scarf. Is there a way to have these things react with cloth physics, so they will trail in the wind while running? Would it be better to model the character nude and attach the pieces of clothing to extra bones as child actors or something?
syntaxerror22
01-05-2010, 06:12 PM
I have this same type of character. I would recommend attaching the cloth as separate meshes using sockets. That way you can be sure the physics will collide properly with the player model. Just make sure your cloth setting are correct and awake on startup =3
danimal'
01-06-2010, 02:34 PM
Search the forums for Nvidia and Physx and maybe tutorial to narrow it down. It's in the documentation forum.
I posted Nvidia's tutorial on using cloth, and they demo a cloth skirt interacting with legs.
danimal
billysson
01-07-2010, 05:47 PM
Ok, I just watched the tut you linked to danimal', cheers for that. Now I'm wondering if it would be better to make all of my character's clothing seperate meshes with cloth physics attached. Nothing exotic, for example, a hooded sweatshirt. I can imagine the visual benefit to be trivial to dress a character this way, but it could be nice. My concern would be the resources required to do this, as well as for all other NPCs. Are cloth physics and the proper mesh setups that much more expensive rather than modeling the character with clothing and skinning it all to a skeleton?
danimal'
01-07-2010, 08:02 PM
I can't authoritatively answer that, but if you take it very far, yes it will be substantially more expensive. However, I see no reason you can't pick and choose your battles. Have your character's jeans and sweatshirt hard-modeled, and then have the "hood" be a physx cloth. If you don't over use this method, it should still run nicely.
While rigid bodies are less expensive than cloth, so this analogy isn't terribly fair, Epic regularly uses attached rigid bodies (as opposed to attached cloth) on their characters and it runs just fine. Which may be another solution, for a pony tail, or a hard piece of armor, it may make more sense to make it a rigid body which will still bounce around but be less expensive.
A dirty test might be to set up a cloth object in the editor, and then setup something that interacts with it (like a force actor, I think they interact). Then put 10 cloths in your scene, then 50, then 100 and see how it impacts performance.
eastgate2
02-12-2010, 12:39 PM
I have this same type of character. I would recommend attaching the cloth as separate meshes using sockets. That way you can be sure the physics will collide properly with the player model. Just make sure your cloth setting are correct and awake on startup =3
My cloth simulations just plays fine and react fine both in game and in anim editor. However, when I add it to the character as separate skeletal mesh using sockets, I could never get it show the cloth simulation. The cloth mesh is attached fine and moves with the character in the anim editor but with no cloth simulation.
Any help?
djfdat
03-06-2010, 02:03 PM
So the solution is that we have to make a separate SkeletalMeshComponent rigged up just for the cloth, and then attach it to the Character Skeletal Mesh through a socket?
Setting the cloth bone hierarchy in the Skeletal Mesh Editor apparently is no use. I have a character with a cape, and I've set everything in the Skeletal Mesh Editor to have it look how I want minus the collision. How comes these settings don't carry over into the game?
mightyenigma
04-26-2011, 07:16 PM
I have the same question. I have a little character with a cloth he uses to wipe his helmet clean. it simulates fine in the animSet editor when I click the Cloth button, but not in the alien character's animset editor when I attach it to his hand socket. Neither does it simulate in the game. The result is that he looks like he's carrying a hug piece of cardboard.
Do I need to state cloth bones for the attached skeletalmesh of the wipe-rag, in the alien skeletalmesh options, too, and not just the rag's options?
I'm currently looking to see if I need to set ForceCPUSkinning in the cloth component's defaultproperties (in our alienPawn class)
mightyenigma
04-26-2011, 07:31 PM
I tried copying a bunch of cloth bools from SkeletalmeshComponent.uc into my defaultproperties but still it stayed stiff.
but then I found this neat function to set the cloth to be enabled so now my post startup on the pawn looks like this:
simulated event PostBeginPlay()
{
super.PostBeginPlay();
if (Mesh != none && alienRemoteStaticMesh != none)
{
Mesh.AttachComponentToSocket(alienRemoteStaticMesh , 'rightHandSocket');
}
//Can I have two components on one socket?
if (Mesh != none && myAlienCloth != none)
{
Mesh.AttachComponentToSocket(myAlienCloth, 'rightHandSocket');
myAlienCloth.SetEnableClothSimulation(true);
}
//we HAVE to do this or the player will never get to jump!
SetTimer(jumpCoolDown, false, 'JumpReady', );
}
Yeah, I know there's already something in his hand... I'll have to find a way to hide it during the idle animation where he wipes his helmet.
Anyway, it works now! :D
mightyenigma
04-29-2011, 04:35 PM
As for clothing that wraps around the character's body, rather than hanging off of it, there's something else called ClothingAsset I think.... don't know anything about it though.
Did anyone get this working (for clothing on body)? I seem to be dealing with something alike.
Whaaabamb
04-08-2012, 08:40 PM
Hey can you explain that code a bit more? I'm tying something similar but no dice for me.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.