# spring

> The spring attempts to reach a target angle by adding spring and damping forces.

## Definition

* **Type:** Property
* **Namespace:** [UnityEngine](/engine/6000.7/script-reference/unityengine.md)
* **Assembly:** UnityEngine.PhysicsModule

```csharp
public JointSpring spring { get; set; }
```

### Remarks

The [\_spring](/engine/6000.7/script-reference/unityengine/jointspring/spring.md) force attempts to reach the target angle. A larger value makes the spring reach the target position faster.

The [\_damper](/engine/6000.7/script-reference/unityengine/jointspring/damper.md) force dampens the angular velocity. A larger value makes the spring reach the goal slower.

The spring reaches for the [\_targetPosition](/engine/6000.7/script-reference/unityengine/jointspring/targetposition.md) angle in degrees relative to the rest angle. The rest angle between the bodies is always zero at the beginning of the simulation.

Modifying the spring does **not** automatically enable it.

Enabling the [\_motor](/engine/6000.7/script-reference/unityengine/hingejoint/motor.md) **overrides** the spring, given the spring was enabled. If the motor is again disabled the spring will be restored.

Additional Resources: [\_useSpring](/engine/6000.7/script-reference/unityengine/hingejoint/usespring.md), [JointSpring](/engine/6000.7/script-reference/unityengine/jointspring.md), [\_useAcceleration](/engine/6000.7/script-reference/unityengine/hingejoint/useacceleration.md)

### Examples

```csharp
using UnityEngine;
using System.Collections;


public class HingeExample : MonoBehaviour
{
    void Start()
    {
        HingeJoint hinge = GetComponent<HingeJoint>();

        // Make the spring reach shoot for a 70 degree angle.
        // This could be used to fire off a catapult.

        JointSpring hingeSpring = hinge.spring;
        hingeSpring.spring = 10;
        hingeSpring.damper = 3;
        hingeSpring.targetPosition = 70;
        hinge.spring = hingeSpring;
        hinge.useSpring = true;
    }
}
```
