Game Development Community

Flowing Hair

by Pete Michaud · in Torque Game Builder · 09/14/2009 (9:52 am) · 6 replies

I'm creating a side scroller, and the player character has very long hair. What I'd like to do is prerender all the sprites of her moving and jumping, and what have you, but simulate the hair dynamically, so I can make it flow and move according to her momentum. I think it could look really interesting on screen, but I'm not sure the right approach to take using TGB. It's almost like particles, but I really don't think that will work. If you were simulating long, flowing hair, how would you do it?

#1
09/14/2009 (11:28 am)
Myself- I would look into ropes, or simulating chains, or something like that, and then figure out how to migrate that to maybe a spline and then turn that into hair. It's kludgy though, I think, but it's a hard problem. There should be some stuff about it on the net for googling, though probably not Torque related.
#2
09/14/2009 (12:24 pm)
Rope simulation makes good sense. I'm new TGB, still getting a sense of what's possible. Are there built in vertices and springs? Or would I need to just fake it with groups of objects?

If you were to write the system, where would you start?
#3
09/14/2009 (4:12 pm)
why not just animate it?

As in make sure you have say a 12 cell animation for her jumping/running what have you. Make sure the hair is adjusted correctly throughout the sequence. It would eliminate any extra work with coding or dealing with particles.



#4
09/15/2009 (8:18 am)
That's not really going to work. The concept is to create hair that's really long, and have it flow like a ribbon dancer's ribbon:

www.danheller.com/images/California/SanFrancisco/People/Yo/Carnival/Carnival04/chinese-ribbon-dance-2.jpg
So an example of when this wouldn't be feasible to animate is when the character is running left (the hair flowing behind), then makes a sudden turn right. The hair continues on its previous path, and the player actually passes the far tip going the other direction, before that tip has a chance to turn around and follow the roots.

I thought about all the scenarios in which prerendering animations for hair like this would be monumental, and I decided that a simulation would work best aesthetically.

Now I just need to know where to start. Good ol' TGB documentation... sigh.
#5
09/15/2009 (11:19 am)
You should look into the existing Box2d TGB integration and see if you could build on that to have chains, that should get you what you're looking for.

#6
09/15/2009 (12:29 pm)
Yeah, probably. It's a pretty big undertaking just get to hair though, lol!

I'd have to buy the source license of the TGB also. I am willing to do it if I have to, but boy it would be swell if I could get some basic primitives going.