Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Adding Solvers to Obi Updaters at Runtime
#2
(16-09-2023, 07:19 PM)scionious Wrote: Hey there!

I have enemies (ships on the ocean) that spawn in dynamically and I'd like to add their various cloth solvers (there are about 6 solvers per enemy) to an Obi Updater component in the scene (fixed update). And I'm also concerned about frame rate stuttering when enemies load in and out of the scene (since we are also planning to use dynamic loading in the scene to save on memory and compute as the player explores an open-world map).

How would I go about getting the solvers to dynamically add themselves and remove themselves from this master obi fixed update component at runtime?

(Amazing asset by the way. I have 66 cloth solvers simulating cloth physics on some single-sided low poly sails on ships, and I'm using the proxy feature to get two-sided cloth working with proper lighting on each side) running in realtime at the moment, and it takes about 2ms of the frame.)

Figured it out:

obiMasterFixedUpdater.GetComponent<ObiUpdater>().solvers.Add(solver);

Remove the same way with .Remove(solver)

Probably should do this in a new thread, but what's the process for doing this with WindZones? Is there a measurable performance cost with just instancing a new one for each enemy instance? I'd like to add them the same way, but I think it's an Array instead of a List and I'm not sure I have enough brain cells to figure that one out.
Reply


Messages In This Thread
RE: Adding Solvers to Obi Updaters at Runtime - by scionious - 17-09-2023, 05:39 AM