Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Move fluid based on device orientation - ObiSphericalForceZone?
#1
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.
Reply
#2
(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.
Reply
#3
(01-11-2018, 06:17 PM)josemendez Wrote: 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.

Thanks. It was the solver.UpdateParameters() that I was missing.
Reply
#4
(01-11-2018, 06:17 PM)josemendez Wrote: 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.

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
Reply
#5
(05-11-2018, 04:36 PM)AdrienMondot Wrote: 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

Try
Code:
solver.parameters.gravity
.
Reply
#6
(05-11-2018, 08:02 PM)josemendez Wrote: Try
Code:
solver.parameters.gravity
.

Thanks a lot!
Reply