class

Flock::Collision::Physics2D

Inherits Flock::Resource < Reference < Object

Global 2D physics configuration + reusable broadphase, held as a World resource. Inserted by Physics2DPlugin.

Constructors

new(gravity : Flock::Vec2 = Flock::Vec2.new(0, -9.81), velocity_iterations : Int32 = 8, cell : Number = 1.0, allow_sleeping : Bool = true, sleep_linear_threshold : Float32 = 0.0025_f32, sleep_angular_threshold : Float32 = 0.0025_f32, sleep_time : Float32 = 0.5_f32, broadphase : Symbol = :hash)
Source

Instance methods

add_joint(j : Joint2D) : Nil
Source
allow_sleeping

Sleeping: bodies at rest are deactivated per contact island.

Source
allow_sleeping=(allow_sleeping : Bool)

Sleeping: bodies at rest are deactivated per contact island.

Source
broadphase

Broadphase strategy: :hash (uniform spatial hash) or :sweep (SAP).

Source
broadphase=(broadphase : Broadphase2D)

Broadphase strategy: :hash (uniform spatial hash) or :sweep (SAP).

Source
contact_cache

Accumulated contact impulses from the previous step (warm starting).

Source
contact_cache=(contact_cache : Hash(UInt64, Array(CachedImpulse2D)))

Accumulated contact impulses from the previous step (warm starting).

Source
gravity
Source
gravity=(gravity : Flock::Vec2)
Source
joints
Source
joints=(joints : Array(Joint2D))
Source
sleep_angular_threshold
Source
sleep_angular_threshold=(sleep_angular_threshold : Float32)
Source
sleep_linear_threshold
Source
sleep_linear_threshold=(sleep_linear_threshold : Float32)
Source
sleep_time
Source
sleep_time=(sleep_time : Float32)
Source
velocity_iterations
Source
velocity_iterations=(velocity_iterations : Int32)
Source