A torsion spring applies a torque based on a relative angle and a relative angular velocity. Specifically, torsion springs try to bring two axes from two parts together in a compliance way.
This constraint is ideal for building vehicle suspension.
Determines whether the angular motion of attachments' secondary axes is limited.
This property determines how the angular velocity is dampened by the constraint and is expressed as the torsional damping c_t in the formula: T=-k_t (Δ*Θ) - c_t (Δ⋅Θ). The value defaults to 0.01.
Damping of the torsion spring causes the spring to oppose the relative angular velocity. For instance, if the two axes are rotating toward each other with an angular velocity (Δ⋅Θ < 0) an opposing torque will try to slow down this relative rotation (T>0). If the axes were rotating away from each other (Δ⋅Θ > 0) an opposing torque (T<0) will slow down this angular velocity. In both cases, the damping is resulting in a torque that opposes the motion.
In the example below, developers can change the damping of the torsion spring as follows:
1torsionSpring.Damping = 1.02
This property, when enabled, limits the relative angular motion of the secondary axes of attachments through a cone constraint. The default value is false.
In the example below, you can enable a cone limit on the relative motion of the secondary axes as follows:
1torsionSpring.LimitEnabled = true2
This property determines the maximum angle (in degrees) of the TorsionSpringConstraint's limiting cone. The limiting cone is formed at the position of the constraint's Attachment0 around its secondary axis with an angle equal to MaxAngle. The default value is 45.0 degrees.
In the example below, when LimitEnabled is true for the constraint, the maximum angle between the primary axes of attachments can be limited to 10 degrees for instance as follows:
1torsionSpring.MaxAngle = 102
This property determines the maximum torque supported by the spring. The value defaults to 1000.0.
If a part isn't moving, consider raising this value (and also check that it is not Anchored or attached to another anchored part).
What is torque
Torque is equivalent to a force applied over a distance (T = force * distance). The same way that applying a force translates into pulling/pushing an object, applying a torque results in rotating the object.
Setting the MaxTorque
In the example below, you can change the maximum torque provided by the torsion spring as follows:
1torsionSpring.MaxTorque = 3002
This property how elastic Attachments connected by a TorsionSpringConstraint are when they reach the end of the range specified by MaxAngle when LimitEnabled is true. The value defaults to 0 and can be any floating number within the range [0, 1].
1torsionSpring.Restitution = 02
What is restitution
Restitution determines the damping effect that the constraint applies when it reaches its limits.
Imagine you release a ball from some distance and it hits the ground. If the restitution of the surface is 1 then the ball will return to its original height (no energy is damped). If the restitution is 0 the ball will stick to the ground (all the energy is lost). Similarly, automobiles rely on damping for shock absorption as do some "slow-close" doors.
All the values between 0 and 1 will simulate something between these to extreme cases.
This property determines the magnitude of the opposing torque of the spring, in the absence of damping, and is expressed as k_t in the formula: T=-k_t (Δ*Θ) - c_t (Δ⋅Θ). The value defaults to 100.
In the absence of damping, the opposing torque of the spring is proportional to the stiffness parameter. For instance, higher stiffness results in a larger opposing torque, and smaller stiffness results in a smaller opposing torque. The larger the torque value, the faster the axes are pushed together when the relative angle is positive (or away from each other if the relative angle is negative).
In the example below, developers can change the stiffness of the torsion spring as follows:
1torsionSpring.Stiffness = 10002