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: Cylinder] [Next: Sphere]

Primitives Tutorial


Plane


Draws a plane on the XZ axis with a center on (0,0,0).

The set of properties for a plane model resource are:

NameDefaultDescriptionRange
length1.0The size of the plane along the Z axisAny float larger than zero
widthThe size of the plane along the X axis
lengthVertices2The number of subdivisions along a dimension. The higher the number, the larger the number of triangles used to draw the plane. 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

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


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



The following script creates a plane 50x50. 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("aPlane",#plane,#both)
  
  mr.length = 50
  mr.width = 50
  mr.LengthVertices = 2
  mr.WidthVertices = 2
  m = member("world").newModel("aPlaneInstance",mr)
  -- rotate the plane -45 degress on the X axis
  m.rotate(-45,0,0)
end



[Previous: Cylinder] [Next: Sphere]



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

Lighthouse 3D privacy statement