Cloth not updated in builds - 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: Cloth not updated in builds (/thread-2665.html) |
Cloth not updated in builds - fluidman84 - 25-12-2020 Using Unity 2020.1.15f1 with Obi Cloth v. 5.6.2. Continuation of the project including Final IK in forum thread thread link. Everything simulating correctly in the editor as expected, but as soon as I export a PC build of the scene, there is no cloth simulation happening at all. As a system test, I've exported the example scene "CharacterCloth" and it works in a build exactly the same way as in the editor. What elements could contribute to the cloth not being simulated while in a build, but appearing fine in the editor. I suspect this this is a simple setting, but I cannot find a suggestion in the user docs. RE: Cloth not updated in builds - josemendez - 28-12-2020 (25-12-2020, 12:47 AM)fluidman84 Wrote: Using Unity 2020.1.15f1 with Obi Cloth v. 5.6.2. Make sure FinalIK and Obi are being updated in the correct order: FIK first, then Obi. By default final ik is updated in LateUpdate, so it will be the other way around. You want bone posituons adjusted by Final IK before Obi feeds them into the cloth simulation. Also keep in mind that the order in which Unity calls FixedUpdate(), Update() and LateUpdate() methods for different components is essentially random. So if you were to update Obi in LateUpdate() by using ObiLateUpdater, (or FinalIK in FixedUpdate, leaving Obi in its own FixedUpdate()) things could work well in-editor but not in standalone or vice-versa. You’d be relying on pure luck, as you leave it up to Unity to call Obi’s FixedUpdate or FIK’s FixedUpdate() first. You need to be explicit about the order in which you want things to happen during your frame. So, update FinalIK and Obi explicitly in a single FixedUpdate() call. RE: Cloth not updated in builds - fluidman84 - 29-12-2020 My apologies, but I'm not finding the Obi solver manual update methods as I am the Final IK examples for disabling / enabling. I've tried this, but it does not appear to have solved the issue. Code: using System.Collections; RE: Cloth not updated in builds - josemendez - 29-12-2020 (29-12-2020, 01:00 AM)fluidman84 Wrote: My apologies, but I'm not finding the Obi solver manual update methods as I am the Final IK examples for disabling / enabling. I've tried this, but it does not appear to have solved the issue. In your code, you’re just enabling/disabling Obi’s built in profiler. Needless to say that won’t update the simulation. (Or profile it, as there’s nothing to profile there ) You can derive from the ObiUpdater class to update Obi whenever you want, as suggested in thr manual: http://obi.virtualmethodstudio.com/tutorials/updaters.html To do this, just look up ObiUpdater in the API docs: http://obi.virtualmethodstudio.com/api.html You'll see it has several methods to advance the simulation: BeginStep, Substep, EndStep, and Interpolate. You can also check the different existing subclasses of ObiUpdater (ObiFixedUpdater, ObiLateUpdater, etc) for examples on how/when to call these methods. The typical pattern would be: Code: BeginStep(); So: one call to BeginStep() (performs collision detection and clears up cached data), one or more calls to Substep() (advances simulation), one call to EndStep(); (calls collision callbacks) and one call to Interpolate(); (interpolates physics state and triggers rendering). The simplest thing for you to do is to just make a copy of ObiFixedUpdater, and then insert the FinalIK update code in the appropiate place. Note this isn’t the only possible solution. You just need things to update in a specific order, so you can also use Unity’s script execution order to explicitly set the order in which components should be updated, instead of writing a single component that updates both Obi and FinalIK. See: https://docs.unity3d.com/Manual/class-MonoManager.html RE: Cloth not updated in builds - fluidman84 - 30-12-2020 Thank you Jose for this detailed response. I've created 2 different Final IK Characters to test this on. One Character contains the clothing skinned on the base character mesh and the other the clothing is a separate object from the base mesh and copies the bones from the base character to deform. In both systems, the clothing behaves as expected in the editor and then has no simulation in the build (but does still deform with the IK skele). The FixedUpdate method to my modified Updater are as follows: Code: private void FixedUpdate() I've tried placing the Final IK Solver as several places in the ObiFixedUpdater, but the result is always the same in builds. RE: Cloth not updated in builds - josemendez - 30-12-2020 (30-12-2020, 10:47 PM)fluidman84 Wrote: Thank you Jose for this detailed response. I've created 2 different Final IK Characters to test this on. One Character contains the clothing skinned on the base character mesh and the other the clothing is a separate object from the base mesh and copies the bones from the base character to deform. In both systems, the clothing behaves as expected in the editor and then has no simulation in the build (but does still deform with the IK skele). I’m unable to reproduce this behavior. Both ik and cloth work fine on the build for me. What platform are you building for, and what solver backend are you using? (Oni or Burst)? Also, any errors in the build’s log? RE: Cloth not updated in builds - fluidman84 - 31-12-2020 I decided to simply rebuild the Final IK rig with the custom updater in the CharacterCloth Scene that you were kind enough to provide with the Obi Cloth package. When doing that, everything works as expected in builds, so it must be something incorrectly setup in my scene file. Slightly frustrating to not be able to pinpoint the exact issue that's causing the problem in that scene, but I may track it down later if I have some time. In any case, everything is looking good and I sincerely appreciate your valuable time to help me troubleshoot my specific utilization of it!! |