ludic/packages/ludic.physics/native.ludic
Orkuncakilkaya e909ec122c feat(character): 16.8 - on land a physics walker moves the body (CharacterGround.walk); the package's own gravity, ballistic air and slope-probe refusal are gone
The package keeps the rules and hands them over each step: speed and heading, whether a jump
leaves, CHAR_STEP and the boots' slope limit. The walker (Jolt CharacterVirtual) does gravity,
landing, steps, slopes and following the ground down. Too steep is ground too steep facing the way
the body wanted to go; stepping off an edge is not. ludic.physics: phys_walker_move (follow the body
if something else moved it, then step), the slope limit, the jump always honoured. The character's
tests run on a real Jolt walker over the same fake world: 15 pass, a knee-high boulder now a step.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-27 00:47:14 +03:00

45 lines
4.8 KiB
Text

# native.ludic - the shim's symbols (native/shim/jph_shim.cpp). A world and a shape are handles
# the package keeps; a body is an int id. None of this is exported.
extern function jph_world_new(max_bodies: int, threads: int) -> pointer = "jph_world_new"
extern function jph_world_free(w: pointer) -> void = "jph_world_free"
extern function jph_world_gravity(w: pointer, y: float) -> void = "jph_world_gravity"
extern function jph_world_step(w: pointer, dt: float, sub: int) -> int = "jph_world_step"
extern function jph_world_optimize(w: pointer) -> void = "jph_world_optimize"
extern function jph_world_bodies(w: pointer) -> int = "jph_world_bodies"
extern function jph_contacts_drain(w: pointer, ids: pointer, vals: pointer, cap: int) -> int = "jph_contacts_drain"
extern function jph_contacts_lost(w: pointer) -> int = "jph_contacts_lost"
extern function jph_shape_box(hx: float, hy: float, hz: float) -> pointer = "jph_shape_box"
extern function jph_shape_sphere(r: float) -> pointer = "jph_shape_sphere"
extern function jph_shape_capsule(half_h: float, r: float) -> pointer = "jph_shape_capsule"
extern function jph_shape_cylinder(half_h: float, r: float) -> pointer = "jph_shape_cylinder"
extern function jph_shape_dome(r: float, h: float) -> pointer = "jph_shape_dome"
extern function jph_shape_offset(s: pointer, x: float, y: float, z: float, yaw: float) -> pointer = "jph_shape_offset"
extern function jph_shape_heightfield(h: pointer, n: int, ox: float, oz: float, cell: float) -> pointer = "jph_shape_heightfield"
extern function jph_shape_mesh(v: pointer, nv: int, tri: pointer, nt: int) -> pointer = "jph_shape_mesh"
extern function jph_shape_free(s: pointer) -> void = "jph_shape_free"
extern function jph_body_add(w: pointer, s: pointer, x: float, y: float, z: float, yaw: float, motion: int, layer: int, mass: float, friction: float, bounce: float) -> int = "jph_body_add"
extern function jph_body_remove(w: pointer, id: int) -> void = "jph_body_remove"
extern function jph_body_read(w: pointer, id: int, out: pointer) -> int = "jph_body_read"
extern function jph_body_place(w: pointer, id: int, x: float, y: float, z: float, yaw: float) -> void = "jph_body_place"
extern function jph_body_impulse(w: pointer, id: int, x: float, y: float, z: float) -> void = "jph_body_impulse"
extern function jph_body_velocity(w: pointer, id: int, x: float, y: float, z: float) -> void = "jph_body_velocity"
extern function jph_body_target(w: pointer, id: int, x: float, y: float, z: float, yaw: float, dt: float) -> void = "jph_body_target"
extern function jph_body_awake(w: pointer, id: int) -> int = "jph_body_awake"
extern function jph_body_buoyancy(w: pointer, id: int, sy: float, nx: float, ny: float, nz: float, buoy: float, lin: float, ang: float, cx: float, cz: float, dt: float) -> int = "jph_body_buoyancy"
extern function jph_ray(w: pointer, ox: float, oy: float, oz: float, dx: float, dy: float, dz: float, mask: int, out: pointer) -> int = "jph_ray"
extern function jph_top_at(w: pointer, x: float, z: float, r: float, from_y: float, depth: float, mask: int) -> float = "jph_top_at"
extern function jph_overlap(w: pointer, x: float, y: float, z: float, r: float, mask: int, ids: pointer, cap: int) -> int = "jph_overlap"
extern function jph_push(w: pointer, x: float, z: float, r: float, y0: float, y1: float, mask: int, out: pointer) -> int = "jph_push"
extern function jph_step_top(w: pointer, x: float, z: float, r: float, feet: float, reach: float, mask: int) -> float = "jph_step_top"
extern function jph_char_new(w: pointer, r: float, h: float, x: float, y: float, z: float, max_slope: float, mass: float) -> pointer = "jph_char_new"
extern function jph_char_free(k: pointer) -> void = "jph_char_free"
extern function jph_char_limits(k: pointer, step_up: float, stick: float, max_slope: float) -> void = "jph_char_limits"
extern function jph_char_step(w: pointer, k: pointer, dt: float, vx: float, vz: float, jump: float) -> int = "jph_char_step"
extern function jph_char_read(k: pointer, out: pointer) -> void = "jph_char_read"
extern function jph_char_place(w: pointer, k: pointer, x: float, y: float, z: float) -> void = "jph_char_place"
extern function jph_body_force(w: pointer, id: int, x: float, y: float, z: float) -> void = "jph_body_force"
extern function jph_body_torque(w: pointer, id: int, x: float, y: float, z: float) -> void = "jph_body_torque"
extern function jph_body_angular_impulse(w: pointer, id: int, x: float, y: float, z: float) -> void = "jph_body_angular_impulse"
extern function jph_body_spin(w: pointer, id: int, out: pointer) -> void = "jph_body_spin"
extern function jph_body_set_pose(w: pointer, id: int, x: float, y: float, z: float, qx: float, qy: float, qz: float, qw: float, vx: float, vy: float, vz: float) -> void = "jph_body_set_pose"
extern function jph_shape_heightfield_bspline(tex: pointer, n: int, ox: float, oz: float, cell: float) -> pointer = "jph_shape_heightfield_bspline"