OpenGL VRML
Home Books Applications Tools Docs Models Textures

Please send me your comments
Tutorials List

Primitives Tutorial

Index

Introduction
Model Resources
Models

Primitive Types

Box
Cylinder
Plane
Sphere

Interactive Section

[Previous: Models] [Next: Cylinder]

Primitives Tutorial


Box


Box is one of the primitive types that comes with Director.

The set of properties for a box model resource are:

NameDefaultDescriptionRange
length50.0The size of the box along the Z axisAny float larger than zero
widthThe size of the box along the X axis
heightThe size of the box along the Y axis
lengthVertices2The number of subdivisions along a dimension. The higher the number, the larger the number of triangles used to draw the box. Setting this value has implications on the performance. If you're not using wireframe mode or want to have lighting effects (using Directors lights) then stick to the default.Any integer equal to or larger than 2
widthVertices
heightVertices
toptrueDetermines if a particular side is visible. Note that front is facing the negative Z axis, i.e. when using the default camera you're actually looking at the back of the box. You can create an open box by setting one of the sides to false.true or false
bottom
front
left
right
back

In order to retrieve the actual value of the length of a model resource called "aBox" you could write something like:


    
	len = member("world").modelResource("aBox").length



The following script creates a box. To try it create a new movie, add a Shockwave 3D member to the score, name it "world" and attach this script to the sprite.


    
on beginSprite me
  
  w = member("world")
  w.resetWorld()
  mr = w.newModelResource("aBox",#box,#front)

  mr.length = 50
  mr.width = 50
  mr.height = 100
  mr.left = true
  mr.right = true
  mr.front = true
  mr.back = false
  mr.top = true
  mr.bottom = true
  m = member("world").newModel("aBoxInstance",mr)
end



[Previous: Models] [Next: Cylinder]



Site designed and maintained by António Ramires Fernandes
Your comments, suggestions and references to further material are welcome!

Lighthouse 3D privacy statement