Class: Material

b5. Material

b5.Material

new b5.Material(name){b5.Material}

resource/material.js, line 38

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

Example showing how to create a physics material

 var material = new b5.Material("floor");
 material.type = "static";
 material.density = 1;
 material.friction = 0.1;
 material.restitution = 0.5;

For a complete overview of Resources see Booty5 Resources Overview

Name Type Description
name string

Name of material resource

Properties:
Name Type Description
parent b5.App | b5.Scene

Parent resource manager (internal)

name string

Name of this image atlas resource

type string

Type of physics material (static, dynamic or kinematic)

density number

Material density, higher values make for heavier objects

friction number

Material friction, lower values make objects more slippery

restitution number

Material restitution, lower values make he object less bouncy

gravity_scale number

Gravity scale, lower values lessen the affects of gravity on the object

fixed_rotation boolean

Set to true to prevent objects from rotating

is_bullet boolean

Set to true if fast moving object

Returns:
Type Description
b5.Material The created material

Methods

destroy()

resource/material.js, line 57

Removes the material from the scene / app and destroys it