Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  stutter move
#11
Just to try and understand what you're trying to do: the idea is to have a full screen fluid simulation that can be controlled using the phone's movement, is this right?

If so, a much simpler approach is to keep the container static and just set the gravity vector to point in the same direction reported by the phone.


Back to the original problem presented:

Quote:Here with that code that changes the value once in Update loop:

Changing the angular velocity once will have no effect at all. You need to update it every frame, otherwise it is assumed to be zero for a kinematic rigidbody.

Quote:In the next video, I'm modifying the angular velocity of the rigidbody with Is kinematic unchecked. As you could see, the fluid looks a bit behind the container but at least there is no stutter bug.

Ideally, you'd subscribe to the solver's OnBeginStep event, and modify the rigidbody velocity there, before fluid simulation takes place. That would prevent the fluid from lagging behind the rigidbody (otherwise there's a 1 frame delay introduced).
Reply
#12
Oh wow I didn't think about the gravity!

Thanks a lot! I owe you a beer!
Reply
#13
(23-09-2020, 03:18 PM)julienrobert Wrote: Oh wow I didn't think about the gravity!

Thanks a lot! I owe you a beer!

Nice! Sonrisa I love beer Corazón

Just keep in mind that gravity is expressed in the solver's local space. If your solver is at 0,0,0, zero rotation, unit scale, world and solver space are the same and no conversions will be needed.

So you can just do:
Code:
solver.parameters.gravity = <your gravity>
solver.PushSolverParameters();  // or UpdateParameters(), depending on which Obi version you're using
Reply