class
Eagle::Physics3D::World
- Eagle::Physics3D::World
- Reference
- Object
Overview
A 3D physics simulation. See Physics3D for an example.
Defined in:
eagle/physics/physics3d.crInstance Method Summary
-
#add(type : BodyType, position : Vec3, shape : Shape) : Body
Creates a body with one shape, adds it and returns it.
-
#add_body(b : Body) : Body
Adds an existing body and returns it.
-
#began : Array({Eagle::Physics3D::Body, Eagle::Physics3D::Body})
Pairs of bodies that started touching in the last step.
-
#bias_factor : Float32
How aggressively overlap is corrected, from 0 to 1.
-
#bias_factor=(bias_factor : Float32)
How aggressively overlap is corrected, from 0 to 1.
-
#bodies : Array(Eagle::Physics3D::Body)
Every body in the world.
-
#cell_size : Float32
Broad-phase grid cell size in meters.
-
#cell_size=(cell_size : Float32)
Broad-phase grid cell size in meters.
-
#clear : Nil
Removes every body.
-
#contact_begin : Eagle::Emitter(Body, Body)
Emitted during a step when two bodies start touching.
-
#contact_end : Eagle::Emitter(Body, Body)
Emitted during a step when two bodies stop touching.
-
#emit_contact_begin(*args) : Nil
Emitted during a step when two bodies start touching.
-
#emit_contact_end(*args) : Nil
Emitted during a step when two bodies stop touching.
-
#ended : Array({Eagle::Physics3D::Body, Eagle::Physics3D::Body})
Pairs of bodies that stopped touching in the last step.
-
#gravity : Vec3
Acceleration applied to dynamic bodies, in m/s².
-
#gravity=(gravity : Vec3)
Acceleration applied to dynamic bodies, in m/s².
-
#iterations : Int32
Solver iterations per step.
-
#iterations=(iterations : Int32)
Solver iterations per step.
-
#move_and_slide(body : Body, motion : Vec3, max_slides : Int32 = 4) : Array(Vec3)
Moves a body by motion, sliding along obstacles.
-
#on_contact_begin(&block : Body, Body -> Nil) : Proc(Body, Body, Nil)
Emitted during a step when two bodies start touching.
-
#on_contact_end(&block : Body, Body -> Nil) : Proc(Body, Body, Nil)
Emitted during a step when two bodies stop touching.
-
#probe_floor(body : Body, up : Vec3, distance : Float32, max_angle : Float32) : Vec3 | Nil
Looks for ground below the body without moving it.
-
#query_aabb(box : AABB, mask : UInt32 = 4294967295_u32) : Array(Body)
Every body whose bounds overlap box.
-
#query_point(p : Vec3, mask : UInt32 = 4294967295_u32) : Array(Body)
Every body containing p.
-
#query_sphere(center : Vec3, radius : Number, mask : UInt32 = 4294967295_u32) : Array(Body)
Every body overlapping a sphere, for explosions and proximity checks.
-
#raycast(origin : Vec3, direction : Vec3, max_distance : Number = 1e6, mask : UInt32 = 4294967295_u32, exclude : Body | Nil = nil) : RayHit | Nil
Casts a ray and returns the closest hit, or
nil. -
#remove_body(b : Body) : Nil
Removes a body.
-
#sleep_threshold : Float32
Speed below which resting bodies stop being simulated.
-
#sleep_threshold=(sleep_threshold : Float32)
Speed below which resting bodies stop being simulated.
-
#slop : Float32
Overlap allowed before correction, in meters.
-
#slop=(slop : Float32)
Overlap allowed before correction, in meters.
-
#step(dt : Float32) : Nil
Advances the simulation by dt seconds.
Instance Method Detail
Creates a body with one shape, adds it and returns it.
Pairs of bodies that started touching in the last step.
Emitted during a step when two bodies start touching.
Pairs of bodies that stopped touching in the last step.
Moves a body by motion, sliding along obstacles. Returns the normals hit.
Emitted during a step when two bodies start touching.
Emitted during a step when two bodies stop touching.
Looks for ground below the body without moving it. Returns the floor normal if found.
Every body whose bounds overlap box.
Every body overlapping a sphere, for explosions and proximity checks.
Casts a ray and returns the closest hit, or nil.
Speed below which resting bodies stop being simulated. 0 disables sleeping.
Speed below which resting bodies stop being simulated. 0 disables sleeping.