Material API Reference


b5.Material

A Material represents a physical material and is assigned to Actor fixtures which modifies their behaviour within the physics engine. Generally a Bitmap should be added to either a scene or the global app’s resources so that it can be managed by them

Public properties

  • name – The name of the material, this name is used when searching for bitmap resources in a Scene’s resources or the the app’s global resources
  • type – Type of material (can be static, dynamic or kinematic)
  • density – Material density, higher values make for heavier objects
  • friction – Material friction, lower values make objects more slippery
  • restitution – Material restitution, lower values make he object more bouncy
  • gravity_scale – Gravity scale, lower values lessen the affects of gravity on the object
  • fixed_rotation – Set to true to prevent objects from rotating
  • is_bullet – Set to true if fast moving object

Methods

Material(name) – Creates an instance of a Material object.

  • name – Name of the bitmap

destroy() – Removes the material from the scene / app and destroys it

Examples

Example showing how to create a physics material

 

653 total views, 1 views today