# moveObject (Shared)

> Moves an object smoothly to a position, turning it along the way.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Shared
- **Category**: Objects
- **URL**: https://wiki.mymp.gg/en/moveObject

## Syntax

```lua
bool moveObject(element object, int time, float x, y, z [, float rx, ry, rz = 0, 0, 0, string easingType = "Linear", float easingPeriod = 0.3, float easingAmplitude = 1, float easingOvershoot = 1.70158])
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `object` | `element` | The object. It may also be a parent element: every object below it moves. |
| `time` | `int` | The duration in milliseconds. With 0 or less, the object goes straight to the destination. |
| `x, y, z` | `float` | The destination. A `vec3` also works. |
| `rx, ry, rz` | `float` | How much to turn during the movement, in degrees, added to the current rotation. A `vec3` also works. *(default: `0, 0, 0`)* |
| `easingType` | `string` | The easing curve, such as `"Linear"`, `"InOutQuad"`, `"OutBounce"` or `"SineCurve"`. *(default: `"Linear"`)* |
| `easingPeriod` | `float` | The period of the elastic curves. *(default: `0.3`)* |
| `easingAmplitude` | `float` | The amplitude of the elastic and bounce curves. *(default: `1`)* |
| `easingOvershoot` | `float` | How far the `Back` curves overshoot the target. *(default: `1.70158`)* |

## Returns

`true` if the element given is an object.

On the server, the movement reaches every client. A new `moveObject` replaces the movement under way.

## Example

```lua
local gate = createObject("electricgate", 2500.0, -1680.0, 13.0)

addCommandHandler("opengate", function()
    moveObject(gate, 3000, 2500.0, -1680.0, 7.0, 0, 0, 0, "InOutQuad")
end)
```

## See also

- [stopObject (Shared)](https://wiki.mymp.gg/en/stopObject.md): Stops an object's movement wherever it is.
- [onClientObjectMoveStart (Client)](https://wiki.mymp.gg/en/onClientObjectMoveStart.md): Fired on this client when an object starts a moveObject movement, whether this client or the server made it.
- [onClientObjectMoveStop (Client)](https://wiki.mymp.gg/en/onClientObjectMoveStop.md): Fired on this client when an object's movement ends: it arrived, stopObject stopped it or a new moveObject took over.
- [getEasingValue (Shared)](https://wiki.mymp.gg/en/getEasingValue.md): Works out an easing curve's value at a point of the progress.
