El componente Spring Joint 2D permite que dos objetos Sprite controlados por física de rigidbody estén juntos como si fueran un resorte. El resorte aplicará una fuerza a lo largo de su eje entre los dos objetos, intentando mantenerlos a una cierta distancia a parte.
Propiedad: | Función: |
---|---|
Enable Collision | Pueden los dos objetos conectados colisionar con el uno con el otro? |
Connected Rigid Body | Specify here the other object this joint connects to. Leave this as None and the other end of the joint will be fixed at a point in space defined by the Connected Anchor setting. Select the circle to the right of the field to view a list of objects to connect to. |
Auto Configure Connected Anchor | Check this box to automatically set the anchor location for the other object this joint connects to. (Check this instead of completing the Connected Anchor fields.) |
Anchor | The place (in terms of X, Y co-ordinates on the RigidBody) where the end point of the joint connects to this object. |
Connected Anchor | The place (in terms of X, Y co-ordinates on the RigidBody) where the end point of the joint connects to the other object. |
Auto Configure Distance | Check this box to automtically detect the distance between the two objects and set it as the distance that the joint keeps between the two objects. |
Distance | La distancia la cual el resorte debería intentar mantenerse entre los dos objetos. |
Damping Ratio | The degree to which you want to suppress spring oscillation: In the range 0 to 1, the higher the value, the less movement. |
Frequency | La frecuencia a la cual el resorte oscila mientras los rigidbodies están acercándose a la deseada distancia de separación (ciclos por segundo). |
Break Force | Specify the force level needed to break and so delete the joint. Infinity means it is unbreakable. |
(See also Joints 2D: Details and Hints for useful background information on all 2D joints.)
This joint behaves like a spring. Its aim is to keep a linear distance between two points. You set this via the Distance setting. Those two points can be two Rigidbody2D components or a Rigidbody2D component and a fixed position in the world. (Connect to a fixed position in the world by setting Connected Rigidbody to None). The joint aplies a linear force to both rigid bodies. It doesn’t apply torque (an angle force).
The joint uses a simulated spring. You can set the spring’s stiffness and movement:
A stiff, barely moving spring…
A high (1,000,000 is the highest) Frequency == a stiff spring.
A high (1 is the highest) Damping Ratio == a barely moving spring.
A loose, moving spring…
A low Frequency == a loose spring.
A low Damping Ratio == a moving spring.
When the spring applies its force between the objects, it tends to overshoot the distance you have set between them, and then rebound repeatedly, giving in a continuous oscillation. The Damping Ratio sets how quickly the objects stop moving. The Frequency sets how quickly the objects oscillate either side of the target distance.
This joint has one constraint:
For Example:
You can use this joint to construct physical objects that need to react as if they are connected together using a spring or a connection which allows rotation. Such as:
HINTS: