[Advanced Programming] Clothing physics without actually using physics?

F

Fun Looking Games

Guest
Hello there, fellow programmers!

I am currently working on a 2D metroidvania game that contains a character that might use a scarf on his neck! I know that there might be a way to do it without heavy pixel arting using programming knowledge or shaders.

It would work like this: the scarf would be very very light, which would make it have almost no movement except for the gravity or wind effects when the character is standing still or running around. The scarf would not move until its dragged by the player's neck when he moves. Its complicated but there HAS to be a way of doing it!

Thanks in advance.
 

Simon Gust

Member
Hello there, fellow programmers!

I am currently working on a 2D metroidvania game that contains a character that might use a scarf on his neck! I know that there might be a way to do it without heavy pixel arting using programming knowledge or shaders.

It would work like this: the scarf would be very very light, which would make it have almost no movement except for the gravity or wind effects when the character is standing still or running around. The scarf would not move until its dragged by the player's neck when he moves. Its complicated but there HAS to be a way of doing it!

Thanks in advance.
Sounds like a job for spine or general vertex drawing.
 
F

Fun Looking Games

Guest
Could you show us how detailed should the scarf be?
Sure.


Simple stuff, very low res, the circled part (the tail) will be what would be animated via programming, since the part that goes around the neck doesn't move except for some pixels depending on the animation.
 

DukeSoft

Member
I've been working around with this as well, a bit. Closest I had come (that worked fine for me) was using different points that make up the vertices. (I think I had about 4 vertices for a simple flag). Apply gravity and pulling forces to each one of them and then draw a texture over it. Makes it feel like "cloth" with very little coding required.
 
F

Fun Looking Games

Guest
I've been working around with this as well, a bit. Closest I had come (that worked fine for me) was using different points that make up the vertices. (I think I had about 4 vertices for a simple flag). Apply gravity and pulling forces to each one of them and then draw a texture over it. Makes it feel like "cloth" with very little coding required.
Doing an object that only cycles through the same movement is way easier than actually coding something that follows the player around based of physics I think, isn't it? Nice game btw.
 

zendraw

Member
perhaps you draw couple sprites of the scarf in couple states like, idle, motion etc. and assign them depending on its angle and the speed of which its in motion.
 

DukeSoft

Member
@Fun Looking Games it boils down to the same principle I guess, but following the movement with a delay might look weird if you go left/right/left/right/left etc.

some simple pulling / stretching forces will fix those issues and make it look "thin" and wavey
 
Top