# Pre motion event

### **This event is** [**cancellable**](/rise-6-scripting-api/api-documentation/events.md#cancellable-events)**.**

This event will be called before the motion is applied. Handler name is `onPreMotion`.

### `setPosX(posX): Undefined`

| Argument | Type     | Description               |
| -------- | -------- | ------------------------- |
| `posX`   | `Number` | Player position X to set. |

Sets the event position on the X axis.

### `setPosY(posY): Undefined`

| Argument | Type     | Description               |
| -------- | -------- | ------------------------- |
| `posY`   | `Number` | Player position Y to set. |

Sets the event position on the Y axis.

### `setPosX(posZ): Undefined`

| Argument | Type     | Description               |
| -------- | -------- | ------------------------- |
| `posZ`   | `Number` | Player position Z to set. |

Sets the event position on the Z axis.

### `setYaw(yaw): Undefined`

| Argument | Type     | Description                |
| -------- | -------- | -------------------------- |
| `yaw`    | `Number` | Player yaw rotation to set |

Sets the event rotation on the yaw axis.

### `setPitch(pitch): Undefined`

| Argument | Type     | Description                  |
| -------- | -------- | ---------------------------- |
| `pitch`  | `Number` | Player pitch rotation to set |

Sets the event rotation on the pitch axis.

### `setOnGround(groundState): Undefined`

| Argument      | Type      | Description                     |
| ------------- | --------- | ------------------------------- |
| `groundState` | `Boolean` | Value of player.onGround to set |

Sets the event ground state.

### `getPosX(): Number`

Returns the Position X of the event.

### `getPosY(): Number`

Returns the Position Y of the event.

### `getPosZ(): Number`

Returns the Position Z of the event.

### `getYaw(): Number`

Returns the yaw rotation of the event.

### `getPitch(): Number`

Returns the pitch rotation of the event.

### `isOnGround(): Boolean`

Returns the ground state of the event.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://riseclients-organization.gitbook.io/rise-6-scripting-api/api-documentation/events/module-events/pre-motion-event.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
