Scripting

Search The Documentation:

  1. Home
  2. Docs
  3. Scripting
  4. GameState
  5. createGlobalMaterial

createGlobalMaterial

Platform Compatibility

PC Mac OSX Oculus Quest
X X X

Global materials are shared between all objects by unique name, you only need to load them once on the first level that loads.

In addition to the base texture, there’s a few extra textures you can use:

  • Metallic map
    • Sometimes called “Roughness” this represents how smooth or rough the surface is
  • Normal map
    • Used for improving the effect of lights on the material, giving a sense of depth
  • Heightmap
    • Used for further adjusting the “scale” of the texture, to make it feel less flat
  • Emission map
    • A texture mapping the lighting generated by the material, such as an electronic billboard

Parameters:

  • name
    • A string to identify the material, must be unique
  • texturemap
    • A string pointing to the local or web file
  • metallicmap (optional)
    • A string pointing to the local or web file
  • normalmap (optional)
    • A string pointing to the local or web file
  • heightmap (optional)
    • A string pointing to the local or web file
  • emissionmap (optional)
    • A string pointing to the local or web file
  • applyToSelf (optional, defaults to FALSE)
    • A boolean value whether to use the material as soon as we make it

Example:

1
obj.createGlobalMaterial("myMaterial", "myLevel/maintex.png","myLevel/metallic.png","myLevel/normalmap.png","myLevel/heightmap.png","myLevel/emissionmap.png", false)

Compatible Texture Formats

Tags
Was this article helpful to you? Yes No

How can we help?