# Move(Vector3)

> Supplies the movement of a GameObject with an attached CharacterController component.

## Definition

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

```csharp
public CollisionFlags Move(Vector3 motion)
```

### Parameters

**** (\[Vector3]\(/engine/6000.0/script-reference/unityengine/vector3)):&#x20;

### Returns

| Type                                                                            | Description |
| ------------------------------------------------------------------------------- | ----------- |
| [CollisionFlags](/engine/6000.0/script-reference/unityengine/collisionflags.md) |             |

### Remarks

The [CharacterController.Move](/engine/6000.0/script-reference/unityengine/charactercontroller/move.md) motion moves the GameObject in the given direction. The given direction requires absolute movement delta values. A collision constrains the [CharacterController.Move](/engine/6000.0/script-reference/unityengine/charactercontroller/move.md) from taking place. The return, [CollisionFlags](/engine/6000.0/script-reference/unityengine/collisionflags.md), indicates the direction of a collision: None, Sides, Above, and Below. [CharacterController.Move](/engine/6000.0/script-reference/unityengine/charactercontroller/move.md) does not use gravity.

The example below demonstrates how to use [CharacterController.Move](/engine/6000.0/script-reference/unityengine/charactercontroller/move.md). Update causes a [CharacterController.Move](/engine/6000.0/script-reference/unityengine/charactercontroller/move.md) to re-position the player. In addition, Jump changes the player position in a vertical direction.

### Examples

```csharp
// This first example shows how to move using Input System Package (New)

using UnityEngine;
using UnityEngine.InputSystem;

public class Example : MonoBehaviour
{
    private float playerSpeed = 5.0f;
    private float jumpHeight = 1.5f;
    private float gravityValue = -9.81f;

    private CharacterController controller;
    private Vector3 playerVelocity;
    private bool groundedPlayer;

    [Header("Input Actions")]
    public InputActionReference moveAction; // expects Vector2
    public InputActionReference jumpAction; // expects Button

    private void Awake()
    {
        controller = gameObject.AddComponent<CharacterController>();
    }

    private void OnEnable()
    {
        moveAction.action.Enable();
        jumpAction.action.Enable();
    }

    private void OnDisable()
    {
        moveAction.action.Disable();
        jumpAction.action.Disable();
    }

    void Update()
    {
        groundedPlayer = controller.isGrounded;
        if (groundedPlayer && playerVelocity.y < 0)
        {
            playerVelocity.y = 0f;
        }

        // Read input
        Vector2 input = moveAction.action.ReadValue<Vector2>();
        Vector3 move = new Vector3(input.x, 0, input.y);
        move = Vector3.ClampMagnitude(move, 1f);

        if (move != Vector3.zero)
        {
            transform.forward = move;
        }

        // Jump
        if (jumpAction.action.triggered && groundedPlayer)
        {
            playerVelocity.y = Mathf.Sqrt(jumpHeight * -2.0f * gravityValue);
        }

        // Apply gravity
        playerVelocity.y += gravityValue * Time.deltaTime;

        // Combine horizontal and vertical movement
        Vector3 finalMove = (move * playerSpeed) + (playerVelocity.y * Vector3.up);
        controller.Move(finalMove * Time.deltaTime);
    }
}
```
