Help stutter move - 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 stutter move (/thread-2507.html) Pages:
1
2
|
stutter move - julienrobert - 22-09-2020 Hello I think I have a conflict between the movement of my container and the fluid inside because I'm getting a kind of stutter when I move the container. Please see video. https://youtu.be/e_W4O8sMdEk How can I solve this? Do I need to move the container using fixedUpdate? or something like that? RE: stutter move - josemendez - 22-09-2020 (22-09-2020, 03:29 AM)julienrobert Wrote: Hello Hi, Even if you move your container in FixedUpdate() (which is the obvious thing to do, as it's interacting with physics), you'd still get some stuttering as the physics engine can only react to movement after it has happened. The ideal solution is to make the container a rigidbody and use torques to rotate it. This way, the collision detection system can work with the container's angular velocity to predict its movement and act accordingly. RE: stutter move - julienrobert - 22-09-2020 Hi thanks! I must be missing something because as soon as I add a rigidbody to my container, it doesn't collider anymore with the fluid. Here are the properties. RE: stutter move - josemendez - 22-09-2020 (22-09-2020, 01:01 PM)julienrobert Wrote: Hi thanks! Make sure the mass ratio of your fluid and the rigidbody is sane, eg: don't have a 1 kg rigidbody with 1000 kg particles. You can check the mass of your particles in the fluid blueprint inspector. RE: stutter move - julienrobert - 22-09-2020 (22-09-2020, 01:06 PM)josemendez Wrote: Make sure the mass ratio of your fluid and the rigidbody is sane, eg: don't have a 1 kg rigidbody with 1000 kg particles. You can check the mass of your particles in the fluid blueprint inspector. I figured the problem was that convex was not checked in the mesh collider. My next challenge will be to synchronize the movement of my iPhone with the movement of the container. It worked before using rotation, I expect using Torque will be quite difficult! RE: stutter move - josemendez - 22-09-2020 (22-09-2020, 02:06 PM)julienrobert Wrote: I figured the problem was that convex was not checked in the mesh collider. No need to calculate the torque that would get you to a certain orientation, you could just make the rigidbody kinematic and derive angular velocity from the rotation delta. The formula for that is: Code: // get delta rotation (difference between current rotation and previous rotation) RE: stutter move - julienrobert - 22-09-2020 (22-09-2020, 02:12 PM)josemendez Wrote: No need to calculate the torque that would get you to a certain orientation, you could just make the rigidbody kinematic and derive angular velocity from the rotation delta. The formula for that is: Thanks! I'm trying to implement your code, do I need to put it in FixedUpdate? because the data changing the rotation is in the update loop. RE: stutter move - josemendez - 22-09-2020 (22-09-2020, 02:57 PM)julienrobert Wrote: Thanks! I'm trying to implement your code, do I need to put it in FixedUpdate? because the data changing the rotation is in the update loop. No need . I'm assuming rotation changes only from one Update() to the next, that's why I'm diving by Time.deltaTime instead of Time.fixedDeltaTime. RE: stutter move - julienrobert - 22-09-2020 (22-09-2020, 03:03 PM)josemendez Wrote: No need . I'm assuming rotation changes only from one Update() to the next, that's why I'm diving by Time.deltaTime instead of Time.fixedDeltaTime. Ok then I must be doing something wrong. There is my code attached to the object. No error in the console. I'm still getting the stutter I had. Code: void Update() RE: stutter move - julienrobert - 23-09-2020 After some tests with angular velocity on a kinematic rigidbody, I think changing its angular velocity has no effect because the angular stays at 0 even when I try to modify it (I think for one frame it goes to the value and come back right after to 0). Here with that code that changes the value once in Update loop: Code: if (angleVel != angleVelPrev) https://youtu.be/BLsyd_ZUm9U and here if I change the value at each frame, the value of the angular stays at the value I want but doesn't seam to affect the fluid. Code: transform.GetComponent<Rigidbody>().angularVelocity = angleVel; https://youtu.be/-W3yNZI5dGA One sure thing is that the fluid doesn't react to any angular velocity I'm trying to input (even 0,0,1000) when rigidbody is Kinematic. 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. https://youtu.be/wqhsv4SavNY In the last video, I'm modifying the rotation at fixedUpdate rate and the stutter problem is still there, maybe less present, hard to say. https://youtu.be/SARTH-0lV7k So, I'm still struggling to deal with this problem. The ideal would be to control the orientation of the container with angular velocity but it's not an easy problem. |