# Revolute Joint 2D

> Aego 0.12.5 · development; docs build `4a32b816933e02930662f6a443cb25abe6050d090c55e237cbff5c44ae9b25f8`. [Build manifest](/docs-build.json).

```
component physics.RevoluteJoint2D
```

Pins this body to the Target body at Anchor, with an optional limit and motor.

## From a script

Open a door with the joint motor and let it swing freely when the motor is off.

```aes check
package level

script Door {
    var Open bool

    func Toggle() {
        Open = !Open
        hinge := node.Get<RevoluteJoint2D>()
        hinge.EnableMotor = Open
        hinge.Speed = 1.5
        hinge.MaxTorque = 200
    }
}
```

## Fields

| Name | Script name | Type | Default | Description |
|---|---|---|---|---|
| Target | `Target` | `NodeRef` | `none` | The body this one turns around; both nodes need a Rigid Body 2D. |
| Anchor | `Anchor` | `Vec2` | `(0, 0)` | Pivot point in this node's space; both bodies turn around it. |
| Enable Limit | `EnableLimit` | `bool` | `false` | Keeps the angle between Lower and Upper. |
| Lower | `Lower` | `float` | `0` | Smallest angle in radians, relative to the angle at start. |
| Upper | `Upper` | `float` | `0` | Largest angle in radians, relative to the angle at start. |
| Enable Motor | `EnableMotor` | `bool` | `false` | Drives the joint at Speed, up to Max Torque. |
| Speed | `Speed` | `float` | `0` | Motor speed in radians per second; negative turns the other way. |
| Max Torque | `MaxTorque` | `float` | `0` | Strongest torque the motor may apply; with 0 the motor does nothing. |
| Collide Connected | `CollideConnected` | `bool` | `false` | Lets the two connected bodies collide with each other. |
