Yesterday, 12:08 PM
(This post was last modified: Yesterday, 12:19 PM by josemendez.)
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,
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,