class

Flock::Collision::Physics2DPlugin

Inherits Flock::Plugin < Reference < Object

Wires 2D physics into a Flock App:

  • inserts the Physics2D resource (gravity, solver iterations, broadphase)
  • registers the Contact2D event type
  • runs Collision.step each FixedUpdate (label :physics2d)

app.add_plugin(Flock::Collision::Physics2DPlugin.new(gravity: Flock::Vec2.new(0, -20)))

Order your movement/input systems with before: :physics2d / after: :physics2d as needed.

Constructors

new(gravity : Flock::Vec2 = Flock::Vec2.new(0, -9.81), velocity_iterations : Int32 = 8, cell : Float32 = 1.0_f32, allow_sleeping : Bool = true)
Source

Instance methods

build(app : Flock::App)
Source