KinematicBody2D in Godot 4: Could not find base class "KinematicBody2D"

By Eduardo Orellana · Updated

KinematicBody2D is called CharacterBody2D in Godot 4, and KinematicBody is CharacterBody3D. A Godot 3 script that extends KinematicBody2D fails to parse with Could not find base class "KinematicBody2D". Extend CharacterBody2D, set the body's velocity property, and call move_and_slide() with no arguments.

What Godot is checking

When GDScript loads a script, the analyzer resolves the class named after extends. KinematicBody2D is not a class in Godot 4, so the script fails to parse and nothing in it runs. The node's type in the scene is not the problem; the script is.

Godot 4 renamed the class. Its 3-to-4 converter carries the pair in its renames table: KinematicBody2D to CharacterBody2D, and KinematicBody to CharacterBody3D.

The rename comes with a change you hit right after: move_and_slide() takes no arguments in Godot 4. The body moves by its velocity property, and the old arguments are properties too: up_direction, floor_stop_on_slope, floor_max_angle and max_slides. A Godot 3 call such as move_and_slide(Vector2(60, 0)) fails to parse with Too many arguments for "move_and_slide()" call. Expected at most 0 but received 1.

Reproduce it

A Godot 3 player script, moved into a Godot 4 project. The scene is one CharacterBody2D with this script.

extends KinematicBody2D

func _physics_process(delta):
	move_and_slide(Vector2(60, 0))

What Godot 4.7.2 prints

Godot Engine v4.7.2.stable.mono.official.ed1daf0bf - https://godotengine.org

SCRIPT ERROR: Parse Error: Could not find base class "KinematicBody2D".
   at: GDScript::reload (res://answers/kinematicbody2d-in-godot-4/repro.gd:1)
ERROR: Failed to load script "res://answers/kinematicbody2d-in-godot-4/repro.gd" with error "Parse error".
   at: load (modules/gdscript/gdscript_resource_format.cpp:46)

Fix it

Extend CharacterBody2D, set velocity, and call move_and_slide() with no arguments. The run prints where the body is after ten physics frames at 60 per second.

extends CharacterBody2D

var frames := 0

func _physics_process(_delta: float) -> void:
	velocity = Vector2(60, 0)
	move_and_slide()
	frames += 1
	if frames == 10:
		print("position after 10 physics frames: ", position)
		get_tree().quit()

What the fixed script prints

Godot Engine v4.7.2.stable.mono.official.ed1daf0bf - https://godotengine.org

position after 10 physics frames: (10.0, 0.0)

The 3D body: KinematicBody is CharacterBody3D

The 3D class took the same rename, KinematicBody to CharacterBody3D, with the same move_and_slide() change: set velocity, then call it with no arguments.

Verified on Godot 4.7.2

Both scripts on this page were run headless on Godot 4.7.2 (4.7.2.stable.mono.official.ed1daf0bf) on 6 October 2026, and the output above is what Godot printed, unedited.

Where the check lives in Godot's source: [gdscript_analyzer.cpp line 572, the message](https://github.com/godotengine/godot/blob/4.7.2-stable/modules/gdscript/gdscript_analyzer.cpp#L572), [renames_map_3_to_4.cpp lines 1533 to 1534, the rename](https://github.com/godotengine/godot/blob/4.7.2-stable/editor/project_upgrade/renames_map_3_to_4.cpp#L1533-L1534), [CharacterBody2D in the class reference](https://github.com/godotengine/godot/blob/4.7.2-stable/doc/classes/CharacterBody2D.xml).

Questions

Where did move_and_slide's arguments go?
They became properties of CharacterBody2D: velocity for the motion, and up_direction, floor_stop_on_slope, floor_max_angle and max_slides for the rest. move_and_slide() reads them and updates velocity after a collision.
Why does an AI assistant keep writing KinematicBody2D?
Most GDScript written before 2023 targets Godot 3, so models trained on it often write Godot 3 names. The parse error at the top of this page is the one that code hits in Godot 4.