![]() |
Move fluid based on device orientation - ObiSphericalForceZone? - 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: Move fluid based on device orientation - ObiSphericalForceZone? (/thread-731.html) |
Move fluid based on device orientation - ObiSphericalForceZone? - p3gamer - 01-11-2018 I am trying to move fluid around when I tilt/rotate the device. I tried adjusting the gravity in the solver (ie. change y value from -9.81f to 9.81f when device is upsideDown), but that didn't seem to work. I am looking into ObiExternalForce, in particular (ObiSphericalForceZone), but I am not sure how to implement this after I added the component to the emitter. RE: Move fluid based on device orientation - ObiSphericalForceZone? - josemendez - 01-11-2018 (01-11-2018, 03:46 PM)p3gamer Wrote: I am trying to move fluid around when I tilt/rotate the device. I tried adjusting the gravity in the solver (ie. change y value from -9.81f to 9.81f when device is upsideDown), but that didn't seem to work. I am looking into ObiExternalForce, in particular (ObiSphericalForceZone), but I am not sure how to implement this after I added the component to the emitter. Hi there, You can use the reading from the device's accelerometer to drive gravity directly. Change the gravity in the solver, and don't forget to call solver.UpdateParameters() afterwards. That should do it. RE: Move fluid based on device orientation - ObiSphericalForceZone? - p3gamer - 02-11-2018 (01-11-2018, 06:17 PM)josemendez Wrote: Hi there, Thanks. It was the solver.UpdateParameters() that I was missing. RE: Move fluid based on device orientation - ObiSphericalForceZone? - AdrienMondot - 05-11-2018 (01-11-2018, 06:17 PM)josemendez Wrote: Hi there, Hi there! Sorry for the totally newbie question : I'm trying to access to the solver gravity in my script, but I'm having compilation errors. 'ObiSolver' does not contain a definition for 'gravity' and no extension method 'gravity' accepting a first argument of type 'ObiSolver' could be found (are you missing a using directive or an assembly reference?) How should I proceed? Thanks for any help. Regards, Adrien RE: Move fluid based on device orientation - ObiSphericalForceZone? - josemendez - 05-11-2018 (05-11-2018, 04:36 PM)AdrienMondot Wrote: Hi there! Try Code: solver.parameters.gravity RE: Move fluid based on device orientation - ObiSphericalForceZone? - AdrienMondot - 07-11-2018 (05-11-2018, 08:02 PM)josemendez Wrote: Try Thanks a lot! |