![]() |
Ragdoll character passing through rope unless thickness is increased - Printable Version +- Obi Official Forum (https://obi.virtualmethodstudio.com/forum) +-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html) +--- Forum: Obi Rope (https://obi.virtualmethodstudio.com/forum/forum-4.html) +--- Thread: Ragdoll character passing through rope unless thickness is increased (/thread-3657.html) Pages:
1
2
|
RE: Ragdoll character passing through rope unless thickness is increased - Milionario - 22-11-2022 (22-11-2022, 04:36 PM)josemendez Wrote: Hi,Tried your suggestions but the only thing that seemed to matter is to change the unity's timestep, unfortunately I can't do that because the 3rd party libraries i am using do not play well with other than default timesteps.. I find it strange that dropping a normal cube on this rope yields the expected results, and a ragdoll doesnt?? If I use two cubes with a fixed joint, i have the same tunneling effect.. not as easy but happens https://youtu.be/FkjiB7hpigE RE: Ragdoll character passing through rope unless thickness is increased - josemendez - 22-11-2022 (22-11-2022, 06:35 PM)Milionario Wrote: Tried your suggestions but the only thing that seemed to matter is to change the unity's timestep, unfortunately I can't do that because the 3rd party libraries i am using do not play well with other than default timesteps.. This is completely normal, as far as how iterative physics engines work. Basically, every body involved in the simulation is simulated independently. Then, joints (aka constraints) adjust the body positions/velocities so that they meet certain conditions, such as making sure their relative rotations or positions are fixed. However this is done iteratively since a single joint can only correct the position of a couple of bodies. So over multiple iterations, these corrections are propagated to adjacent bodies. So when the rope and the torso meet, the rope applies a force to the torso so that the rope and the torso end up just touching each other at the end of the frame. However, all other body parts aren’t aware of this force until a frame has passed by and the physics joints have had a chance to run, and notice the torso is in a position higher than it would otherwise be and pull it down. Now, ideally if Obi and Unity’s physics engine were the same engine, it would be enough to use more iterations to propagate forces trough all bodies. Unfortunately they’re two separate engines running in an interleaved fashion, using forces to interact with each other. So the only possible way to propagate corrections quicker to all rigidbodies in a joint hierarchy is to run both engines more often, hence why: - lowering the global timestep and using only 1 substep for particles works, - the less rigidbodies involved in a ragdoll, the sooner forces are propagated and the better it behaves. - a single cube works fine regardless of the timestep length (since it doesnt have any other bodies constrained to it that would need to have forces/impulses propagated to) If you want fully accurate interplay of ragdolls and rope-like structures using long timesteps, my advice would be to use articulations. A reduced-coordinate sim will work much better, although with some limitations: no compliant materials, no loops in the body hierarchy, and higher runtime cost. RE: Ragdoll character passing through rope unless thickness is increased - Milionario - 22-11-2022 (22-11-2022, 07:38 PM)josemendez Wrote: This is completely normal, as far as how iterative physics engines work. Basically, every body involved in the simulation is simulated independently. Then, joints (aka constraints) adjust the body positions/velocities so that they meet certain conditions, such as making sure relative rotations or positions are fixed. However this is done iteratively since a single joint can only correct the position of a couple of bodies. So over multiple iterations, these corrections are propagated to adjacent bodies.So this is more of a rigidbodies + joints problem than it is solely with the ragdoll RE: Ragdoll character passing through rope unless thickness is increased - josemendez - 22-11-2022 (22-11-2022, 07:40 PM)Milionario Wrote: So this is more of a rigidbodies + joints problem than it is solely with the ragdoll Correct, any joint hierarchy will have this problem in any iterative engine. Ragdolls are just a particular case, they aren’t any different from other joint hierarchies. If you’re ever tried to stack boxes in any physics engine -contacts are just a particular type of joint, that gets created/destroyed at runtime-, you know these tend to sink into each other and the stack becomes unstable unless you use a small timestep (and a plethora of tricks like shock propagation or mass splitting). This gets worse the more boxes you stack, but a single box will never have any issues by itself. All iterative engines suffer from the same or similar issues, since it’s inherent to how they work. The only ways to propagate forces trough a hierarchy of constraints instantly are to use a reduced coordinates approach (ABA/Featherstone’s algorithm) or use a direct solver, and both are expensive enough that lowering the timestep of an iterative engine is often cheaper. RE: Ragdoll character passing through rope unless thickness is increased - Milionario - 23-11-2022 (22-11-2022, 07:45 PM)josemendez Wrote: Correct, any joint hierarchy will have this problem in any iterative engine. Ragdolls are just a particular case, they aren’t any different from other joint hierarchies. Do you think its possible to get the desired result without changing ObiColliders thickness and reducing the Unity's fixed timestep? RE: Ragdoll character passing through rope unless thickness is increased - josemendez - 23-11-2022 (23-11-2022, 02:58 AM)Milionario Wrote: Do you think its possible to get the desired result without changing ObiColliders thickness and reducing the Unity's fixed timestep? Unfortunately not. The correct fix in this situation is to reduce Unity's fixed timestep, changing the thickness of the colliders is a sort of "hack" that allows the rope and the colliders to stay colliding with each other for more frames which ensures enough physics steps take place for the forces to propagate trough all joints in the ragdoll. Using more physics steps (by reducing the timestep) propagates forces in the same amount of time without the need to enlarge colliders. I'm curious as to why you mentioned other packages you use don't work correctly unless you use the default timestep. I mean, timestep size is a parameter and it's meant to be tweaked, the default value of 0.02 (an update frequency of 50 Hz) is seldom sufficient unless physics in your game are quite simple. In some cases, you can get away by increasing the update frequency of Obi alone (by using more substeps) but this isn't one of those cases. kind regards, |