Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

Question Spring and Damper values on Joints constraints

Discussion in 'Physics for ECS' started by Tigrian, Jul 26, 2022.

  1. Tigrian

    Tigrian

    Joined:
    Mar 21, 2021
    Posts:
    125
    Hello,

    I've tried the joints given by the samples (4.a joint parade in particular), and so far so good.

    But now I'd like to implement a spring system (especially on the limited hinge joint), and I'm having trouble understanding how it works. I had a quick look at the sample on soft joints (in the Test section), and I'm still confused.

    Some questions, to help me understand how it works:

    1. What do the Constraint.DefaultSpringFrequency and Constraint.DefaultSpringDamping constants (and therefore the SpringFrequency and SpringDamping values) correspond to? In the soft joint sample, these values are 0.05f for damping, and between 0.5f and 5.0f for Frequency. The most equivalent thing I found in the monobehaviour version to hold on to is the 2D spring joint.
    But in some scripts, the value of springDamping is set to the value
    of Constraint.DefaultSpringDamping which is about 2530f, much higher than the limit of 1 given by the 2D spring joint for the spring damping Ratio. What are recommended values for each spring effect (is it dependent on the mass of the entities in relation)?

    2. Now on the hinge joint, in the MonoBehaviour version, in its spring system, we have the possibility to change the angle to which the spring pulls towards (target position field). What is the equivalent version in the ecs system. Is it the perpendicular Axis that defines this (I see in the visual debug that it influences the limits).

    3. Finally, if I understood correctly, for each constraint, we can assign a spring frequency and spring damping value. But what does this mean when the constraints are an angular limit, a hinge or a pivot (I'm not very good at physics, so you can blame me for not knowing exactly what a spring is if the answer is simple).