3D Lingo Dictionary > L-N > newModelResource |  |

newModelResource

Syntax

    member(whichCastmember).newModelResource(newModelResourceName { ,#type, #facing })

Description

3D command; creates a new model resource, of the given `#type` and `#facing` (if specified), and adds it to the model resource palette.

The `#type` parameter can be one of the following `primitives`:

    #plane
    #box
    #sphere
    #cylinder
    #particle

If you do not choose to specify the `#facing` parameter and specify `#box`, `#sphere`, `#particle` or `#cylinder` for the `#type` parameter, only the front faces are generated, if you specify `#plane`, both the front and back faces are generated. Model resources of the type `#plane` have two meshes generated (one for each side), and consequently has two shaders in the `shaderList`.

The `#facing` parameter can be one of the following:

| `#front`
| `#back`
| `#both`

A facing of `#both` creates the double amount of meshes and consequently produces double the number of shader entries in the `shaderList`. There will be 2 for planes and spheres (for the inside and outside of the model respectively), 12 for cubes (6 on the outside, 6 on the inside), and 6 for cylinders (top, hull and bottom outside, and another set for the inside).

Examples

This handler creates a box. The first line of the handler creates a new model resource called box10. Its type is `#box`, and it is set to show only its back. The next three lines set the dimensions of box10 and the last line creates a new model which uses box10 as its model resource.

    on makeBox
      nmr = member("3D").newModelResource("box10", #box, #back)
      nmr.height = 50
      nmr.width = 50
      nmr.length = 50
      aa = member("3D").newModel("gb5", nmr)
    end

This statement creates a box-shaped model resource called hatbox4.

    member("Shelf").newModelResource("hatbox4", #box)

See also

`primitives`