AddMesh

Summary

The addmesh function is used to add a new asset to the 3D world by importing a 3D model object from a file.

Parameters

File

Type: Path Default: None

Specifies the path to the file which is to be imported.

You may specify any 3D model file as long as it is one of the supported formats. The supported file formats are .obj, .fbx and .ply.

Name

Type: Text Default: None

Specifies the name of the object to be added to the marker. This name can be referred to later by other scripts in order to modify and/or interact with it in some way, such as with the Remove function.

If an object of the same type has the same name, this script will modify the existing object instead of creating a new one.

Position

Type: XYZ Coordinates Default: 0,0,0

The co-ordinates in which to place the asset within the 3D world. Co-ordinates are defined as “x,y,z”, separated by a ',' and no spaces.

Color

Type: RGB or RGBA Default: 1,1,1,1

This parameter sets the color of the new asset. Color must be defined as “r,g,b” or “r,g,b,a” using normalized values (values ranging from 0.0 to 1.0)

ParameterMeaning
rThe value for the amount of red to be applied. Must be a value ranging from 0.0 to 1.0
gThe value for the amount of green to be applied. Must be a value ranging from 0.0 to 1.0
bThe value for the amount of blue to be applied. Must be a value ranging from 0.0 to 1.0
aThe value for the amount of alpha transparency to be applied. Must be a value ranging from 0.0 to 1.0. This parameter is optional
Texture

Type: Path Default: None

Specifies the path to the texture file to be used. Standard bitmap file formats are supported such as .png,.jpg,.bmp.

This applies textures to the new asset, allowing more graphical detail to be added.

Transparent

Type: Boolean Default: False

Specifies whether or not to add an additional transparency effect to the new asset. If true, the object will become transparent.

See Also

Examples

<addmesh File="test.obj" Position="0,2,0" Name="NewObject" Color="0,0,1"/>
This will add an asset called NewObject to the 3D world, using the file test.obj as a mesh. It will be created and positioned at the x,y,z co-ordinates: 0,2,0 respectively. It will also have a color added with the respective r,g,b values 0,0,1 which will give it a shade of blue.
<addmesh File="test.obj" Position="0,2,0" Name="NewObject" AttachTo="AttachToThis"/>
This will add the same NewObject to the 3D world, but also attach it to another asset called AttachToThis. Since an AttachTo parameter was specified, the x,y,z position coordinates will become local to the asset called AttachToThis.
<addmesh File="test.obj" Position="0,2,0" Name="NewObject" Texture=”texture.png”/>
This will create the same NewObject asset again, however this time it will apply a texture from the file texture.png.