Skip to content
ClassTypes & Utilities@public

FlxPhysicsWorld ​

State-scoped owner for an optional physics backend.

Coordinates use Flixel logical pixels, degrees, and seconds. A bound body is positioned at its object's midpoint. Static and kinematic objects push their transforms before each step; dynamic bodies pull solver state afterward.

ts
export declare class FlxPhysicsWorld

Constructors ​

ts
constructor(backend: FlxPhysicsBackendWorld, options?: FlxPhysicsWorldOptions)

Constructs a new instance of the FlxPhysicsWorld class

ParameterTypeDescription
backendFlxPhysicsBackendWorld-
optionsFlxPhysicsWorldOptions-

Properties ​

PropertyModifiersTypeDescription
bodyCountreadonlynumber-
capabilitiesreadonlyFlxPhysicsCapabilities-
contactEndedreadonlyFlxSignal<FlxPhysicsContact>-
contactStartedreadonlyFlxSignal<FlxPhysicsContact>-
contactStayedreadonlyFlxSignal<FlxPhysicsContact>-
destroyedreadonlyboolean-
jointCountreadonlynumber-
paused-boolean-

Methods ​

addBody() ​

ts
addBody(object: FlxObject, definition: FlxPhysicsObjectDefinition): FlxPhysicsBody

Parameters:

ParameterTypeDescription
objectFlxObject-
definitionFlxPhysicsObjectDefinition-

Returns: FlxPhysicsBody

addJoint() ​

ts
addJoint(definition: FlxPhysicsJointDefinition): FlxPhysicsJoint

Parameters:

ParameterTypeDescription
definitionFlxPhysicsJointDefinition-

Returns: FlxPhysicsJoint

destroy() ​

ts
destroy(): void

Returns: void

getBody() ​

ts
getBody(idOrObject: string | FlxObject): FlxPhysicsBody | undefined

Parameters:

ParameterTypeDescription
idOrObjectstring | FlxObject-

Returns: FlxPhysicsBody | undefined

getDebugGeometry() ​

ts
getDebugGeometry(): readonly FlxPhysicsDebugPrimitive[]

Returns: readonly FlxPhysicsDebugPrimitive[]

getJoint() ​

ts
getJoint(id: string): FlxPhysicsJoint | undefined

Parameters:

ParameterTypeDescription
idstring-

Returns: FlxPhysicsJoint | undefined

queryAabb() ​

ts
queryAabb(bounds: FlxPhysicsAabb, filter?: FlxPhysicsQueryFilter): readonly FlxPhysicsQueryHit[]

Parameters:

ParameterTypeDescription
boundsFlxPhysicsAabb-
filterFlxPhysicsQueryFilter-

Returns: readonly FlxPhysicsQueryHit[]

queryPoint() ​

ts
queryPoint(point: FlxPhysicsVector, filter?: FlxPhysicsQueryFilter): readonly FlxPhysicsQueryHit[]

Parameters:

ParameterTypeDescription
pointFlxPhysicsVector-
filterFlxPhysicsQueryFilter-

Returns: readonly FlxPhysicsQueryHit[]

queryRay() ​

ts
queryRay(query: FlxPhysicsRayQuery): readonly FlxPhysicsQueryHit[]

Parameters:

ParameterTypeDescription
queryFlxPhysicsRayQuery-

Returns: readonly FlxPhysicsQueryHit[]

removeBody() ​

ts
removeBody(bodyOrObject: FlxPhysicsBody | FlxObject): boolean

Parameters:

ParameterTypeDescription
bodyOrObjectFlxPhysicsBody | FlxObject-

Returns: boolean

removeJoint() ​

ts
removeJoint(jointOrId: FlxPhysicsJoint | string): boolean

Parameters:

ParameterTypeDescription
jointOrIdFlxPhysicsJoint | string-

Returns: boolean

reset() ​

ts
reset(): void

Returns: void

setGravity() ​

ts
setGravity(gravity: FlxPhysicsVector): void

Parameters:

ParameterTypeDescription
gravityFlxPhysicsVector-

Returns: void

step() ​

ts
step(elapsed: number): void

Parameters:

ParameterTypeDescription
elapsednumber-

Returns: void

Released under the MIT License.