Skip to main content

Plugins

Plugins are official utility modules inside Nature2D that extend the functionality or make certain parts of Nature2D easy to use. Read more about plugins in a tutorial dedicated to them.

Functions

Plugins.Triangle()

Returns a custom rigid body structure for a triangle given positions of its vertices.

  • parameters - a: Vector2, b: Vector2, c: Vector2
  • returns - Structure: { any }

Plugins.Quad()

Returns a custom rigid body structure for a quadrilateral given positions of its vertices.

  • parameters - a: Vector2, b: Vector2, c: Vector2, d: Vector2
  • returns - Structure: { any }

Plugins.MouseConstraint()

Used to make rigid bodies draggable. Rigid bodies can be dragged by holding and draggin their vertices.

  • parameters - engine: Engine, range: number
  • returns - destroyMouseConstraint: () -> ()