BlockCore

BlockCore

Creates a basic class to hold a new rigid body model with a rectangular hull.

This class allows the block
- to be drawn with various attributes
- to be placed as a rectangle "block" in the world as a physical Matter body

Constructor

# new BlockCore(world, attributes, optionsopt)

Parameters:
Name Type Attributes Description
world Matter.World The Matter.js world object
attributes object Visual properties e.g. position, dimensions and color
options Matter.IChamferableBodyDefinition <optional>
Defines the behaviour e.g. mass, bouncyness or whether it can move
Tutorials:

Methods

# draw()

Draws the matter body to the p5 canvas

# drawVertices(vertices)

Parameters:
Name Type Description
vertices Array.<Matter.Vector>