> For the complete documentation index, see [llms.txt](https://solo-player.gitbook.io/most-in-one/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://solo-player.gitbook.io/most-in-one/most-systems/most-grid-move.md).

# MOST Grid Move

A Control system for grid movement (square step movement) with all possible properties of the grid movement like 8-directions movement, speed, obstacles detection, direction correction system, stop point snap, animation control, camera following system (with rotation correction), and much more.

<figure><img src="/files/fdX0VGhTzpEL6NrWURGw" alt=""><figcaption><p>Explosion Template uses MOST_GridMovement</p></figcaption></figure>

The system can detect obstacles (layer mask can be controlled) so the character stops when it is blocked by another object.

also, it comes with a Direction corrector system that makes the character correct its movement direction when the input direction is blocked by obstacles.

<figure><img src="/files/12xT4J33apMN3K1o3CfV" alt="" width="563"><figcaption><p>4-Directions Movement using MOST_GridMovement + MOST_Controller</p></figcaption></figure>

<figure><img src="/files/TTMgCYWMQYkmKkYvMis2" alt=""><figcaption><p>8-Directions Movement using MOST_GridMovement + MOST_Controller</p></figcaption></figure>

{% hint style="info" %}

* <mark style="color:blue;">**This System requires an Input Controller to receive commands (MOST Controller or any other input system)**</mark>
* <mark style="color:blue;">**All examples in MOST IN ONE use MOST Controller as the input source.**</mark>
* <mark style="color:blue;">**It's much better this way to be easier to modify, and if you want to use another Input system instead of MOST Controller.**</mark>
* <mark style="color:blue;">**You will find the "Input Getter" section inside the .cs file contains all functions that receive input commands for this system. Check the API.**</mark>
  {% endhint %}

## <mark style="color:red;">API reference</mark>

{% hint style="success" %} <mark style="color:green;">**All public properties can be updated at runtime, and the changes will be set immediately.**</mark>
{% endhint %}

<pre class="language-csharp"><code class="lang-csharp">// Next to each line shows the return and set data Type 

// Functions
// main behavior enables and disables the system
Most_GridMovement.EnableState(bool Enable);

__________________ Activate/Start __________________
// Start Moving function, call it to enable/start moving
// You can call it if the input doesn't provide direction yet
// example.. when touching the screen without moving the finger
// This method will move the object depending on its rotation
Most_GridMovement.OnInputDetected(); 

<strong>// Optional to call... you can just call OnInputUpdated() to start moving
</strong><strong>
</strong>__________________ Direction Update __________________
<strong>// Call it to update object direction // on controller direction updated
</strong>Most_GridMovement.OnInputUpdated(Vector2 direction);

__________________ On Stop Moving __________________
// the default value for exceed = false
Most_GridMovement.OnInputReleased([Optional] bool exceed);
// Call it to stop the object from moving // on controller release

//_______________________________________________________________//

// ReadOnly variable... Check if the Move system is active or not
Most_GridMovement.Enable; return bool

// ReadOnly variable... Quick check if the object is moving right now or not
Most_GridMovement.IsMoving; return bool

// Controls the moving part of the system, whether it enables (sends data) or not
Most_GridMovement.EnableMove; return or set bool

// Controls the rotation part of the system if it enables (sends data) or not
Most_GridMovement.EnableRotation; return or set bool

// the target direction of the movement system
Most_GridMovement.MoveAxis return or set (TargetAxis.X_Y or TargetAxis.X_Z) ;

// Grid size for MoveAxis
Most_GridMovement.GridSize; return or set float

// Movement Speed of the object
Most_GridMovement.Speed; return or set float

// Rotation speed of the object
Most_GridMovement.RotationSpeed; return or set float

</code></pre>
