For AI agents: the complete documentation index is available at /AchEngine/en/llms.txt, the full documentation bundle is available at /AchEngine/en/llms-full.txt, and this page is available as Markdown at /AchEngine/en/usage/movement.md.

AchMover

AchMover is a plug-in 2D character movement component. It does not use Rigidbody2D; it implements Move-and-Slide collision, gravity, slopes, stairs, and ground snapping directly.

Usage

Add AchMover and a CapsuleCollider2D to the character. Drive movement by setting the input or calling the public movement methods from your controller.

Inspector

Movement

Configure move speed, acceleration, deceleration, jump speed, and air control.

Physics

Configure gravity, terminal velocity, skin width, and collision layers.

Slopes & stairs

Set MaxSlopeAngle and StepHeight to control walkable slopes and automatic stair climbing.

Control

Enable or disable gravity and movement, and choose the update mode appropriate for the controller.

Built-in collision system

Each frame the component:

  1. Combines input, gravity, and jump velocity.
  2. Casts the capsule and slides along collision surfaces, up to four iterations.
  3. Steps over ledges within StepHeight.
  4. Casts below the collider and marks the character grounded when the surface is within MaxSlopeAngle.
  5. Snaps to the ground while descending slopes.
  6. Corrects any remaining penetration.

State properties

var mover = GetComponent<AchMover>();
bool grounded = mover.IsGrounded;
Vector2 velocity = mover.Velocity;

Joystick or custom input

mover.SetMoveInput(new Vector2(horizontal, vertical));
mover.SetJumpPressed();

Code-control API

mover.Move(Vector2.right);
mover.Jump();
mover.AddImpulse(new Vector2(3f, 2f));

Knockback

private void OnHit(Vector2 direction)
{
    GetComponent<AchMover>().AddImpulse(direction.normalized * 8f);
}

Combining UseGravity

Disable UseGravity when another system owns vertical movement. Re-enable it before returning control to AchMover.

AchFollower — AI following

AchFollower is a standalone target-following component. It does not require AchMover.

var follower = GetComponent<AchFollower>();
follower.SetTarget(playerTransform);
follower.ClearTarget();

AchProjectile — projectiles

AchProjectile supports straight and homing projectiles without Rigidbody2D. Configure speed, lifetime, collision layers, and the projectile type in the Inspector, then set the target for a homing shot.

var projectile = Instantiate(projectilePrefab);
projectile.Launch(direction);
projectile.SetTarget(target);

Trigger and collision events

Use the component's hit/trigger callbacks to apply damage or effects. Keep gameplay response in the listener rather than modifying the movement solver.