Skip to content

Search

Voltar
· 2 min de leitura

2D physics

A rapier2d world beside the 3D one, 2D drawing and editing, and the angrynerds example.

Balaur can run a 2D game. A rapier2d world sits beside the 3D one, 2D shapes draw in z order, and the editor gets a 2D grid, camera and gizmo. examples/angrynerds is the first 2D example.

  • body2d and collider2d sit beside body3d and collider3d, over the same scene tree. rapier2d is Rapier's own 2D solver, with its own shapes and its own determinism. Both worlds step on the fixed 60 Hz tick with Rapier's enhanced-determinism on and pass the same bit-for-bit test. Nothing changes on the 3D side.
  • 2D shapes draw in z order.
  • A scene with 2D components gets a 2D grid, a pan-and-zoom camera and a 2D gizmo in the editor. Drag an axis, a plane, or the ring.
  • examples/angrynerds is a slingshot, some towers, and pigs with glasses, in one scene and one script.
[[nodes]]
name = "Bird"
transform = { position = [-8, 2.2, 0] }
body2d = { kind = "kinematic" }

[nodes.shape2d]
kind = "circle"
radius = 0.4

Run it with balaur edit examples/angrynerds, or play it in the browser. The manual covers physics and the editor.

Tens a certeza?