Image
A Matter Physics Image Game Object.
A MatterImage is a standard Phaser Image Game Object with a Matter.js physics body automatically created and attached to it. It combines the lightweight rendering of a static image with the full suite of Matter.js rigid body physics simulation, including gravity, friction, bounce, mass, and accurate collision response against other Matter bodies.
By default, a rectangular physics body matching the image's display dimensions is created. You can supply a custom shape via the options parameter to use a circle, polygon, or a compound body defined in a physics editor such as PhysicsEditor.
Use a MatterImage for non-animated physics objects in your scene, such as platforms, crates, walls, debris, or collectibles. If you need frame-based animation alongside Matter.js physics, use Phaser.Physics.Matter.Sprite instead. The main difference between a MatterImage and a MatterSprite is that MatterImage does not have the Animation component and cannot play texture-based animations.
Constructor
new Image(world, x, y, texture, [frame], [options])
Parameters
| name | type | optional | description |
|---|---|---|---|
| world | Phaser.Physics.Matter.World | No | A reference to the Matter.World instance that this body belongs to. |
| x | number | No | The horizontal position of this Game Object in the world. |
| y | number | No | The vertical position of this Game Object in the world. |
| texture | string | Phaser.Textures.Texture | No | The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. |
| frame | string | number | Yes | An optional frame from the Texture this Game Object is rendering with. |
| options | Phaser.Types.Physics.Matter.MatterBodyConfig | Yes | An optional Body configuration object that is used to set initial Body properties on creation. |
Scope: static
Extends
Phaser.GameObjects.Image
Phaser.Physics.Matter.Components.Bounce
Phaser.Physics.Matter.Components.Collision
Phaser.Physics.Matter.Components.Force
Phaser.Physics.Matter.Components.Friction
Phaser.Physics.Matter.Components.Gravity
Phaser.Physics.Matter.Components.Mass
Phaser.Physics.Matter.Components.Sensor
Phaser.Physics.Matter.Components.SetBody
Phaser.Physics.Matter.Components.Sleep
Phaser.Physics.Matter.Components.Static
Phaser.Physics.Matter.Components.Transform
Phaser.Physics.Matter.Components.Velocity
Phaser.GameObjects.Components.Alpha
Phaser.GameObjects.Components.BlendMode
Phaser.GameObjects.Components.Depth
Phaser.GameObjects.Components.Flip
Phaser.GameObjects.Components.GetBounds
Phaser.GameObjects.Components.Mask
Phaser.GameObjects.Components.Origin
Phaser.GameObjects.Components.ScrollFactor
Phaser.GameObjects.Components.Size
Phaser.GameObjects.Components.Texture
Phaser.GameObjects.Components.Tint
Phaser.GameObjects.Components.Transform
Phaser.GameObjects.Components.Visible
Source: src/physics/matter-js/MatterImage.js#L14
Since: 3.0.0
Inherited Members
From Phaser.GameObjects.Components.Alpha:
From Phaser.GameObjects.Components.BlendMode:
From Phaser.GameObjects.Components.Depth:
From Phaser.GameObjects.Components.Filters:
- filterCamera
- filters
- filtersAutoFocus
- filtersFocusContext
- filtersForceComposite
- maxFilterSize
- renderFilters
From Phaser.GameObjects.Components.Flip:
From Phaser.GameObjects.Components.Lighting:
From Phaser.GameObjects.Components.Mask:
From Phaser.GameObjects.Components.Origin:
From Phaser.GameObjects.Components.RenderNodes:
From Phaser.GameObjects.Components.ScrollFactor:
From Phaser.GameObjects.Components.Size:
From Phaser.GameObjects.Components.TextureCrop:
From Phaser.GameObjects.Components.Tint:
From Phaser.GameObjects.Components.Transform:
From Phaser.GameObjects.Components.Visible:
From Phaser.GameObjects.GameObject:
- active
- body
- cameraFilter
- data
- displayList
- ignoreDestroy
- input
- isDestroyed
- name
- parentContainer
- renderFlags
- scene
- state
- tabIndex
- type
- vertexRoundMode
From Phaser.Physics.Matter.Components.Mass:
Public Members
world
world: Phaser.Physics.Matter.World
Description:
A reference to the Matter.World instance that this body belongs to.
Source: src/physics/matter-js/MatterImage.js#L111
Since: 3.0.0
Inherited Methods
From Phaser.Events.EventEmitter:
- addListener
- emit
- eventNames
- listenerCount
- listeners
- off
- on
- once
- removeAllListeners
- removeListener
- shutdown
From Phaser.GameObjects.Components.Alpha:
From Phaser.GameObjects.Components.BlendMode:
From Phaser.GameObjects.Components.Depth:
From Phaser.GameObjects.Components.Filters:
- enableFilters
- focusFilters
- focusFiltersOnCamera
- focusFiltersOverride
- renderWebGLFilters
- setFiltersAutoFocus
- setFiltersFocusContext
- setFiltersForceComposite
- setFilterSize
- setRenderFilters
- willRenderFilters
From Phaser.GameObjects.Components.Flip:
From Phaser.GameObjects.Components.GetBounds:
- getBottomCenter
- getBottomLeft
- getBottomRight
- getBounds
- getCenter
- getLeftCenter
- getRightCenter
- getTopCenter
- getTopLeft
- getTopRight
From Phaser.GameObjects.Components.Lighting:
From Phaser.GameObjects.Components.Mask:
From Phaser.GameObjects.Components.Origin:
From Phaser.GameObjects.Components.RenderNodes:
From Phaser.GameObjects.Components.RenderSteps:
From Phaser.GameObjects.Components.ScrollFactor:
From Phaser.GameObjects.Components.Size:
From Phaser.GameObjects.Components.TextureCrop:
From Phaser.GameObjects.Components.Tint:
From Phaser.GameObjects.Components.Transform:
- copyPosition
- getLocalPoint
- getLocalTransformMatrix
- getParentRotation
- getWorldPoint
- getWorldTransformMatrix
- setAngle
- setPosition
- setRandomPosition
- setRotation
- setScale
- setW
- setX
- setY
- setZ
From Phaser.GameObjects.Components.Visible:
From Phaser.GameObjects.GameObject:
- addedToScene
- addToDisplayList
- addToUpdateList
- destroy
- disableInteractive
- getData
- getDisplayList
- getIndexList
- incData
- removedFromScene
- removeFromDisplayList
- removeFromUpdateList
- removeInteractive
- setActive
- setData
- setDataEnabled
- setInteractive
- setName
- setState
- setVertexRoundMode
- toggleData
- toJSON
- update
- willRender
- willRoundVertices
From Phaser.Physics.Matter.Components.Bounce:
From Phaser.Physics.Matter.Components.Collision:
- setCollidesWith
- setCollisionCategory
- setCollisionGroup
- setOnCollide
- setOnCollideActive
- setOnCollideEnd
- setOnCollideWith
From Phaser.Physics.Matter.Components.Force:
From Phaser.Physics.Matter.Components.Friction:
From Phaser.Physics.Matter.Components.Gravity:
From Phaser.Physics.Matter.Components.Mass:
From Phaser.Physics.Matter.Components.Sensor:
From Phaser.Physics.Matter.Components.SetBody:
From Phaser.Physics.Matter.Components.Sleep:
From Phaser.Physics.Matter.Components.Static:
From Phaser.Physics.Matter.Components.Transform:
From Phaser.Physics.Matter.Components.Velocity:
- getAngularSpeed
- getAngularVelocity
- getVelocity
- setAngularSpeed
- setAngularVelocity
- setVelocity
- setVelocityX
- setVelocityY