Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Solver is too performance heavy
#31
(17-06-2025, 07:53 AM)josemendez Wrote: Yes, triggers are also included in collision detection and ObiSolver.OnCollision will also report them. Contacts against triggers are simply ignored during collision response.


There can be many reason for a gap to appear. Most of them have to do with how and when you're moving the character in relation to the simulation. Chenji's advice regarding this matter is solid, make sure to double check these points specifically:
  • *You'd better use AddTorque (physics related) to rotate anything, instead of changing GameObject's transform(only affect visual), if you want the rope's behavior close to real world one. *Try to use Synchronous Fixed mode https://obi.virtualmethodstudio.com/manu...html*Check Interpolation of your Rigidbody. Make sure they are same with Obi Solver.*Check the Obi/rigidbody colliders of the conterpart of the problem. For example, if your problem is A and B has a gap, check whether A and B has collisions. Try disable their collision to see whether it works.

kind regards,

Let me be more specific, below I've attached screenshots how it should look and how it works in my demo scene with my player that using active ragdoll based on ConfigurableJoints(example of hierarchy in my answer above). The collider that should follow and be attached to rope is properly attached in test project but not in my main(visible gap on screenshot).

I have tried to change all parts of ObiSolver but it did not help, Solver in test project where all seems OK, same as in my main project, the same situation with rope, I've tried also change hierarchy of player and where GrabCollider is placed, so the problem somewhere else and I can not find it independently. The gap is visible every time player is attached to the rope, the reason why I've mentioned rotation is to be more specific about when the gap is more visible than by default. 

Hope this information will help to understand the situation, kind regards


Attached Files Thumbnail(s)
       
Reply
#32
(17-06-2025, 09:15 AM)quent_1982 Wrote: Let me be more specific, below I've attached screenshots how it should look and how it works in my demo scene with my player that using active ragdoll based on ConfigurableJoints(example of hierarchy in my answer above). The collider that should follow and be attached to rope is properly attached in test project but not in my main(visible gap on screenshot).

I have tried to change all parts of ObiSolver but it did not help, Solver in test project where all seems OK, same as in my main project, the same situation with rope, I've tried also change hierarchy of player and where GrabCollider is placed, so the problem somewhere else and I can not find it independently. The gap is visible every time player is attached to the rope, the reason why I've mentioned rotation is to be more specific about when the gap is more visible than by default. 

Hope this information will help to understand the situation, kind regards

Hi,

Unfortunately it's impossible to determine the cause of this just by looking at screenshots. I would need to take a look at the code in your actual project. If possible, send it to support(at)virtualmethodstudio.com and I'll debug through it.

kind regards,
Reply
#33
(17-06-2025, 09:19 AM)josemendez Wrote: Hi,

Unfortunately it's impossible to determine the cause of this just by looking at screenshots. I would need to take a look at the code in your actual project. If possible, send it to support(at)virtualmethodstudio.com and I'll debug through it.

kind regards,

No problem, I'll send the project to the email as soon as it'll be loaded to Drive.

Kind regards
Reply
#34
(17-06-2025, 01:51 PM)quent_1982 Wrote: No problem, I'll send the project to the email as soon as it'll be loaded to Drive.

Kind regards

Just received your project, will take a look at it and get back to you asap.
Reply
#35
Hi,

Took a look at your project. There's lots of reasons why a noticeable gap appears:

- Your solver is using asynchronous mode. For accurate coupling with rigidbodies, use Synchronous Fixed instead as per the manual.

- You're only using 4 substeps, for a considerably long rope holding a comparatively heavy object (each player has a mass of 4.5 kg, and the rope has a mass of 0.1x2.5 = 0.25 kg). My advice would be to use at least 8-10 substeps. The manual contains an in-depth explanation of how timestep length and mass ratios affect results.

- Most of your rigidbodies are not using interpolation, but the solver is. This will cause a 1-frame delay between the position of the rope and the position of those rigidbodies. Worse still, some of your rigidbodies do use interpolation, which will cause a 1-frame delay with other rigidbodies that don't.

Either use interpolation for everything, or disable it for everything. Otherwise you'll have lots of consistency issues, specially at low frame rates.

- Your ObiPathSmoother is using 2 levels of smoothing. Note that smoothing doesn't render the physical shape of the rope but a smoothed version, so a visual gap with attachments/pinholes will inevitably appear. Your rope has quite high base resolution, smoothing won't make a positive difference but quite the opposite. I'd disable smoothing by setting it to 0.

- You're applying a torsional impulse to the player around its own local axis. This won't make the player swing on the rope at all, instead it will flip around its waist quite unphysically, and violently pull the rope upwards/downwards which exacerbates all the above issues. Much better options would be to apply a left/right relative force, or a world-space force around the rope's top attachment.

Unrelated to the gap, there's other issues in the project. One of them is that you're reading input in FixedUpdate. This is a big mistake in most engines - and Unity in particular, due to how fixed timestepping works: FixedUpdate may be called zero, one, or multiple times per frame. As a result input will work erratically, not being detected during some frames or taking action more than once per frame. You should read input in Update(), cache results, and then react to them in FixedUpdate(). Also note that AddForce in particular doesn't need to be called from FixedUpdate(), as it accumulates changes to object velocities.

kind regards,
Reply
#36
(Yesterday, 12:08 PM)josemendez Wrote: Hi,

Took a look at your project. There's lots of reasons why a noticeable gap appears:

- Your solver is using asynchronous mode. For accurate coupling with rigidbodies, use Synchronous Fixed instead as per the manual.

- You're only using 4 substeps, for a considerably long rope holding a comparatively heavy object (each player has a mass of 4.5 kg, and the rope has a mass of 0.1x2.5 = 0.25 kg). My advice would be to use at least 8-10 substeps. The manual contains an in-depth explanation of how timestep length and mass ratios affect results.

- Most of your rigidbodies are not using interpolation, but the solver is. This will cause a 1-frame delay between the position of the rope and the position of those rigidbodies. Worse still, some of your rigidbodies do use interpolation, which will cause a 1-frame delay with other rigidbodies that don't.

Either use interpolation for everything, or disable it for everything. Otherwise you'll have lots of consistency issues, specially at low frame rates.

- Your ObiPathSmoother is using 2 levels of smoothing. Note that smoothing doesn't render the physical shape of the rope but a smoothed version, so a visual gap with attachments/pinholes will inevitably appear. Your rope has quite high base resolution, smoothing won't make a positive difference but quite the opposite. I'd disable smoothing by setting it to 0.

- You're applying a torsional impulse to the player around its own local axis. This won't make the player swing on the rope at all, instead it will flip around its waist quite unphysically, and violently pull the rope upwards/downwards which exacerbates all the above issues. Much better options would be to apply a left/right relative force, or a world-space force around the rope's top attachment.

Unrelated to the gap, there's other issues in the project. One of them is that you're reading input in FixedUpdate. This is a big mistake in most engines - and Unity in particular, due to how fixed timestepping works: FixedUpdate may be called zero, one, or multiple times per frame. As a result input will work erratically, not being detected during some frames or taking action more than once per frame. You should read input in Update(), cache results, and then react to them in FixedUpdate(). Also note that AddForce in particular doesn't need to be called from FixedUpdate(), as it accumulates changes to object velocities.

kind regards,

Hello, I've followed all your suggestions include interpolation, change PathSmoother settings and so on, but the gap is still there. Could you please let me know the exact settings or values you changed to make it disappear?

Thanks for help, kind regards
Reply
#37
(Yesterday, 06:06 PM)quent_1982 Wrote: Hello, I've followed all your suggestions include interpolation, change PathSmoother settings and so on, but the gap is still there. Could you please let me know the exact settings or values you changed to make it disappear?

Thanks for help, kind regards


I've sent you the fixed project via email.

let me know if you need further help.

kind regards,
Reply