Obi Official Forum
Help How to change gravity in script during runtime? - Printable Version

+- Obi Official Forum (https://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: Obi Fluid (https://obi.virtualmethodstudio.com/forum/forum-3.html)
+--- Thread: Help How to change gravity in script during runtime? (/thread-2716.html)



How to change gravity in script during runtime? - Lazerpants - 23-01-2021

I've just gotten Obi Fluid, and after a lot of experimenting and tinkering, managed to get it to work reasonably well in a Unity project I'm working on. Really cool! However, I would like to/need to be able to change the X and Y gravity Obi Solver settings in script during runtime, but don't see how this is done. I've been looking at the API docs and haven't found what I would need in order to accomplish this. I'm using Unity 2020 and C#.

Any help is appreciated!


RE: How to change gravity in script during runtime? - josemendez - 24-01-2021

Code:
solver.parameters.gravity = <your gravity>
solver.UpdateParameters();

Cheers!


RE: How to change gravity in script during runtime? - Ed_looping - 02-05-2021

(24-01-2021, 11:26 AM)josemendez Wrote:
Code:
solver.parameters.gravity = <your gravity>
solver.UpdateParameters();

Cheers!


Hi. I've a problem...
Solver.UpdateParameters() doesn't exist...


RE: How to change gravity in script during runtime? - josemendez - 03-05-2021

(02-05-2021, 09:32 PM)Ed_looping Wrote: Hi. I've a problem...
Solver.UpdateParameters() doesn't exist...

If you look at the API docs, you’ll see it has been renamed to PushSolverParameters() in newer versions.

Cheers!


RE: How to change gravity in script during runtime? - Ed_looping - 03-05-2021

(03-05-2021, 08:05 AM)josemendez Wrote: If you look at the API docs, you’ll see it has been renamed to PushSolverParameters() in newer versions.

Cheers!

Thx Sonrisa