Primitive Help

Introduction

Provides basic rendering of four main types of primitve: Box, Cone, Cylinder and Sphere.

Nest-able Elements

Due to IMML being an XML type language, a primitive can have other elements nested within. These elements can be nested within a primitive. There can be 0 to Many of these elements nested within.

Below is an example of a Primitive nested within another primitive.

1 <Primitive Name="box" Type="OuterBox" Complexity="VeryLow" Size="1.626015,1.626015,1.626015" Position="-8.791144,14.4288,-2.182026">
2          <Primitive Name="InnerBox" Type="Box" Complexity="VeryLow" Size="1,1,1" Position="-8.538375,14.4288,0.2494407">        
3          </Primitive>
4 </Primitive>

IMML allows only one of these elements within a Primitive

  • Physics
  • Network

Attributes

CastShadows

Type imml:Boolean
Use optional
Default False
Documentation If true and the element is Visible, it should cast shadows

Complexity

Type imml:PrimitiveComplexity
Use optional
Default Medium
Documentation: The complexity of the primitive. The higher the complexity, the greater the quality. The settings are VeryLow, Low, Medium, High, VeryHigh

Pivot

Use optional
Type imml:Vector3
Documentation The pivot point for the element to pivot on when performing transformations

Size

Use optional
Type imml:Vector3
Documentation Size of the element

Type

Type imml:PrimitiveType
Use required
Documentation The type of primitive to represent: Box, Cone, Cylinder or Sphere

Visible

Type imml:Boolean
Use optional
Documentation When true, the element is visible

Examples

Button

One of the most common uses of a Primitive is to serve as a button that the user can click to have something happen. This can be achieved by attaching a trigger to the primitive.

 1 
 2     <Primitive Name="box" Type="Box" Complexity="VeryLow" Size="1,1,1" Position="-38.58308,52.15393,-37.68972">
 3         <MaterialGroup Id="-1">
 4             <Material Ambient="#4c4c4c" Diffuse="#cccccc" Emissive="#000000" Specular="#000000" EnableTextures="True"/>
 5         </MaterialGroup>
 6         <Physics Enabled="False" Movable="False"/>
 7 
 8         <Trigger Name="MyTrigger" Event="MouseClick" Target="MyScript"></Trigger>
 9 
10     </Primitive>

Note how the Trigger element is embedded within the Primitive element. This means that the trigger is embedded within that element. Note the Trigger's attributes Event and Target. Event defines what event activates the trigger in this case it is a mouse click. The Target attribute shows what script will be activated when the Trigger is activated.

See Also

Triggers added to a primitive in Hover Example

SamplePrimitives.png (6.9 kB) Ian Tan, 07/26/2011 02:32 am