acron.character_body_2d¶
CharacterBody2D – Godot’s 2D move_and_slide on the plane-constrained
Bullet world.
The 2D world lives on Acron’s XZ plane (see acron.canvas2d): tiles
are prisms extruded along +-Y (acron.tile_map), and this mover
sweeps a plane-thick shape through them, so slopes and arbitrary convex tile
polygons collide exactly – the same collide-and-slide algorithm as the 3D
acron.character_body, in-plane.
Godot 2D conventions preserved at the API: velocity is pixels/second with
y positive = down; up_direction defaults to Godot’s Vector2.UP
(0, -1); is_on_floor/is_on_wall/is_on_ceiling report contact
against floor_max_angle (default 45 deg). Defaults mirror Godot’s
CharacterBody2D: max_slides 4, floor_snap_length 1.0 px (snap runs
only when grounded last step and not moving up – an unconditional snap
cancels jumps).
One-way platforms: pass one_way_masks={mask: (dx, dy)} – each mask is
swept ONLY while the motion moves against that direction (e.g. a jump-through
floor has dir (0, -1) and collides only while falling). Put one-way
bodies on their own collision layers; solid geometry goes in collide_mask.
|
Kinematic 2D mover. |