Quick answer: Project move vector along slope: Vector3.ProjectOnPlane(input, hit.normal) * speed.
Player walks up 30° slope. Visible slowdown. Move vector wasn’t aligned to surface.
The Fix
void Update() {
if (Physics.Raycast(transform.position, Vector3.down, out var hit, 1.1f)) {
Vector3 input = new(inputX, 0, inputZ);
Vector3 projected = Vector3.ProjectOnPlane(input, hit.normal).normalized * speed;
controller.Move((projected + Vector3.up * gravityY) * Time.deltaTime);
}
}
ProjectOnPlane keeps motion magnitude consistent across slopes. Combined with gravity for falling.
Verifying
Walk up 30° slope: same speed as flat. Without projection: visibly slower.
“Project on slope. Speed holds.”
Related Issues
For step edge snag, see step snag. For 2D slope, see 2D slope.
Project. Speed steady.