This object stores all the information about materials in the game.


This is a global object that can always be accessed.

What’s a material?  Well, it’s the properties that collision shapes have.  For instance, if the shape should be bouncy, a ladder, or a warp.

You can add your own custom materials, then later, during a collision query to see what kind of material you hit.

setup_constants.lua adds material definitions when the engine is started.


C_MATERIAL_ICE = GetMaterialManager:AddMaterial(0.5,0.3, 0.5, 0.3, Color(255,200,50,255), "Ice");
MaterialManagerThis object stores all the information about materials in the game.
Member Functions

Member Functions


number AddMaterial (number friction, number restitution,
number separation, Color color, string name)


frictionA lower number here means its easier for an entity to slide around.
restitutionhow bounce this shape is
separationhow hard the shape tries to push itself out of other shapes.
colora Color object.  This affects the line color in the editor when you show collision.
namewhat name you see when you are clicking the collision line type in the collision editor.


A number to reference the material you created.  Normally you create your materials once at startup and just keep track of these.


If you’re going to be messing with these values or creating your own, it’s only fair that I warn you it’s a very sensitive and flakey system and what seems like it’s working might be broken in other situations.

Also, the final result is what happens when TWO shapes collide, so you have to think about the material type of both pieces and how they will interact.


Material * AddMaterial (number materialID)


materialIDthe materialID you got when the material was created


A pointer to a Material object

The color object stores R G B A color information.
Stores data and properties for an individual material.