![]() |
Flipping cloth? ScaleX == -1? - Printable Version +- Obi Official Forum (https://obi.virtualmethodstudio.com/forum) +-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html) +--- Forum: Obi Cloth (https://obi.virtualmethodstudio.com/forum/forum-2.html) +--- Thread: Flipping cloth? ScaleX == -1? (/thread-1320.html) Pages:
1
2
|
RE: Flipping cloth? ScaleX == -1? - josemendez - 23-08-2019 Here, I wrote this for you. Add it to the cloth component, and set it to update after the solver in ScriptExecutionOrder. This way it is 100% sure it will be done after all simulation is completed. Code: using System.Collections; Works fine, collisions with colliders and all. Still, doing this in the vertex shader would be far more performant. The solver is set up in local space mode, and all colliders, cloth, etc are parented under it. Note that none of the colliders has negative scale, only the solver does. I'm also attaching a video of the results: RE: Flipping cloth? ScaleX == -1? - cubrman - 23-08-2019 (23-08-2019, 10:05 AM)josemendez Wrote: As I already told you, set your solver update mode to FixedUpdate, then write your code after WaitForFixedUpdate: No I see the source of confusion: when I talk about flipping code I mean DE-flipping (putting the hierarchy into normal position, e.g. localScale.x == 1), when you talk about flipping, you mean actual flipping, e.g. setting localScale.x to -1. I now understand everything and will test this later today. One thing bothers me though: I tried setting the model to localScale.x == 1 in my FixedUpdate, while ensuring that my FixedUpdate is called before yours (Script execution order) and then changing it to localScale.x == -1 both in my Update and in my LateUpdate (the cloth is set to simulate in FixedUpdate). What I ended up with was a character that was constantly flipping back and forth. Maybe that was my negligence - we will see. RE: Flipping cloth? ScaleX == -1? - josemendez - 23-08-2019 (23-08-2019, 12:10 PM)cubrman Wrote: No I see the source of confusion: when I talk about flipping code I mean DE-flipping (putting the hierarchy into normal position, e.g. localScale.x == 1), when you talk about flipping, you mean actual flipping, e.g. setting localScale.x to -1. I now understand everything and will test this later today. Lucky you, I'm more confused now ![]() |