Home Books Applications Tools Docs Models Textures

Please send me your comments
Tutorials List

Primitives Tutorial


Model Resources

Primitive Types


Interactive Section

[Previous: Box] [Next: Plane]

Primitives Tutorial


Although named cylinder, this primitive is also useful to create cones and tubes.

The set of properties for a cylinder model resource are:

height50.0The height of the cylinder, i.e. the size along the Y axisAny float larger than zero
topRadius25.0The radius of the top of the cylinder. Set to zero to obtain a coneAny float larger than or equal to zero
bottomRadiusThe radius of the bottom of the cylinder. Set to zero to create an ice cream cone!
topCaptrueDetermines the visibility of the capstrue or false
resolution20Determines the roundness of the cylinder. The higher the value, the larger the number of sides used to build the cylinder. Note however that the value does not correspond to the number of sides, think of it as a roundness factor. This setting has a direct influence on the performance. High values will produce smooth cylinders but will make your application run slower.Any positive integer, larger than zero
numSegments2Determines the number of segments along the Y axis. This setting has very little influence on the smoothness of the cylinder. However when using 3D lights it helps to provide a smoother look. Note that the higher the number the slower the applicationAny positive integer, larger than zero
startAngle0.0A cylinder is built sweeping a line segment around the y axis. The position of the two ends of the line segment depends on the bottomRadius, topRadius and height of the cylinder. The start and end angles determine where the sweep starts and ends. A full cylinder has a startAngle of 0.0 and an endAngle of 360.0. Half a cylinder, or half a tube, can be defined for instance setting the startAngle to 0.0 and the endAngle to 180.0. Any float between 0.0 and the endAngle
endAngle360.0Any float larger than startAngle and smaller or equal to 360.0
Half a cylinder: startAngle=0, endAngle=180 (the cylinder was rotated to get a better view) Cylinder with resolution set to 2 Cylinder with bottomRadius set to 2

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

	len = member("world").modelResource("aCylin").startAngle

The following script creates a cone. 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")
  mr = w.newModelResource("cyl",#cylinder,#front)
  mr.topRadius = 0.0
  m = member("world").newModel("aCylInstance",mr)

[Previous: Box] [Next: Plane]

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

Lighthouse 3D privacy statement