Obi Official Forum

Full Version: Gyroscope in fluid
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, Can I do gyroscope to control the 2d fluid?  Triste I cant figure out how to control the water by using gyroscope controller? is it impossible to do it?
(15-03-2021, 03:37 PM)enchu_99 Wrote: [ -> ]Hi, Can I do gyroscope to control the 2d fluid?  Triste I cant figure out how to control the water by using gyroscope controller? is it impossible to do it?

You can just set the solver gravity, it's pretty easy:

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

How to get the gravity value measured by the hardware varies depending on which input system you're using.
(15-03-2021, 03:52 PM)josemendez Wrote: [ -> ]You can just set the solver gravity, it's pretty easy:

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

How to get the gravity value measured by the hardware varies depending on which input system you're using.
hi thanks for replying. Can I know where do i put these code in which scripts? I know it sound stupid but i am a beginner in this .
Where to put it is completely up to you, typically you'd place it in some script's Update() method.

Note that Obi is a quite complex engine aimed at advanced users, if you're starting with Unity and/or programming it might prove a bit too daunting at first. Fluid simulation shouldn't be your first contact with game making.

cheers!