nape.space.Space

type
class
The heart of all Nape simulations.

Constructor

function new(gravity:nape.geom.Vec2 = (0,0), broadphase:Broadphase = DYNAMIC_AABB_TREE)
+ Construct a new Space object.

Instance Properties

readonly var arbiters : nape.dynamics.ArbiterList

+ List of all active arbiters in Space.

readonly var bodies : nape.phys.BodyList

+ List of all Bodys directly placed in space.

readonly var broadphase : Broadphase

Broadphase type in use.

readonly var compounds : nape.phys.CompoundList

+ List of all Compounds directly placed in space.

readonly var constraints : nape.constraint.ConstraintList

+ List of all Constraints directly placed in space.

readonly var elapsedTime : Float

+ The elapsed simulation time.

var gravity : nape.geom.Vec2 = (0,0)

+ Space gravity.

readonly var listeners : nape.callbacks.ListenerList

+ List of all Listeners in space.

readonly var liveBodies : nape.phys.BodyList

+ List of all active dynamic Bodies in space.

readonly var liveConstraints : nape.constraint.ConstraintList

+ List of all active Constraints in space.

var sortContacts : Bool = true

+ Flag controlling sorting of contact points.

readonly var timeStamp : Int

+ The time stamp of this Space object.

readonly var userData : Dynamic<Dynamic> = {}

+ Dynamic object for user to store additional data.

readonly var world : nape.phys.Body

+ Static, immutable Body for constraint purposes.

var worldAngularDrag : Float = 0.015

+ Angular drag applied to all bodies in Space.

var worldLinearDrag : Float = 0.015

+ Linear drag applied to all bodies in Space.

Instance Methods

function bodiesInAABB(aabb:nape.geom.AABB, containment:Bool = false, strict:Bool = true, filter:nape.dynamics.InteractionFilter = null, output:nape.phys.BodyList = null):nape.phys.BodyList

+ Evaluate all Bodies given an AABB.

function bodiesInBody(body:nape.phys.Body, filter:nape.dynamics.InteractionFilter = null, output:nape.phys.BodyList = null):nape.phys.BodyList

+ Evaluate all Bodies given a Body.

function bodiesInCircle(position:nape.geom.Vec2, radius:Float, containment:Bool = false, filter:nape.dynamics.InteractionFilter = null, output:nape.phys.BodyList = null):nape.phys.BodyList

+ Evaluate all Bodies given a circle.

function bodiesInShape(shape:nape.shape.Shape, containment:Bool = false, filter:nape.dynamics.InteractionFilter = null, output:nape.phys.BodyList = null):nape.phys.BodyList

+ Evaluate all Bodies given a shape.

function bodiesUnderPoint(point:nape.geom.Vec2, filter:nape.dynamics.InteractionFilter = null, output:nape.phys.BodyList = null):nape.phys.BodyList

+ Evaluate all Bodies under a given Point.

function clear():Void

+ Clear the Space of all objects.

function convexCast(shape:nape.shape.Shape, deltaTime:Float, liveSweep:Bool = false, filter:nape.dynamics.InteractionFilter = null):Null<nape.geom.ConvexResult>

+ Perform a convex cast for soonest collision.

function convexMultiCast(shape:nape.shape.Shape, deltaTime:Float, liveSweep:Bool = false, filter:nape.dynamics.InteractionFilter = null, output:nape.geom.ConvexResultList):nape.geom.ConvexResultList

+ Perform a convex cast for all collisions in time order.

function interactionType(shape1:nape.shape.Shape, shape2:nape.shape.Shape):Null<nape.callbacks.InteractionType>

+ Determine the interaction type that would occur between a pair of Shapes.

function rayCast(ray:nape.geom.Ray, inner:Bool = false, filter:nape.dynamics.InteractionFilter = null):Null<nape.geom.RayResult>

+ Perform a ray cast for closest result.

function rayMultiCast(ray:nape.geom.Ray, inner:Bool = false, filter:nape.dynamics.InteractionFilter = null, output:nape.geom.RayResultList = null):nape.geom.RayResultList

+ Perform a ray cast for all valid results.

function shapesInAABB(aabb:nape.geom.AABB, containment:Bool = false, strict:Bool = true, filter:nape.dynamics.InteractionFilter = null, output:nape.shape.ShapeList = null):nape.shape.ShapeList

+ Evaluate all Shapes given an AABB.

function shapesInBody(body:nape.phys.Body, filter:nape.dynamics.InteractionFilter = null, output:nape.shape.ShapeList = null):nape.shape.ShapeList

+ Evaluate all Shapes given a Body.

function shapesInCircle(position:nape.geom.Vec2, radius:Float, containment:Bool = false, filter:nape.dynamics.InteractionFilter = null, output:nape.shape.ShapeList = null):nape.shape.ShapeList

+ Evaluate all Shapes given a circle.

function shapesInShape(shape:nape.shape.Shape, containment:Bool = false, filter:nape.dynamics.InteractionFilter = null, output:nape.shape.ShapeList = null):nape.shape.ShapeList

+ Evaluate all Shapes given another shape.

function shapesUnderPoint(point:nape.geom.Vec2, filter:nape.dynamics.InteractionFilter = null, output:nape.shape.ShapeList = null):nape.shape.ShapeList

+ Evaluate all Shapes under a given Point.

function step(deltaTime:Float, velocityIterations:Int = 10, positionIterations:Int = 10):Void

+ Step simulation forward in time.

function visitBodies(lambda:nape.phys.Body -> Void):Void

+ Apply given function to all bodies in space.

function visitCompounds(lambda:nape.phys.Compound -> Void):Void

+ Apply given function to all compounds in space.

function visitConstraints(lambda:nape.constraint.Constraint -> Void):Void

+ Apply given function to all constraints in space.