Skip to Content
defold-typescript
Get startedGuidesAPILibraries
Defold

b2d

Functions for interacting with Box2D.

Functions

b2d.get_body(url: string | Hash | Url): Opaque<"b2Body"> | undefined

Get the Box2D body from a collision object

Parameters

  • url: string | Hash | Url — the url to the game object collision component

Returns

  • body: Opaque<"b2Body"> | undefined — the body if successful. Otherwise nil.

b2d.get_world(): Opaque<"b2World">

  • Signature changed in Defold 1.13.2

Get the Box2D world from the current collection

Returns

  • world: Opaque<"b2World"> — the world if successful. Otherwise nil.

Types

type b2d.B2Body = Opaque<"b2Body">

type b2d.B2World = Opaque<"b2World">

On this page