Homeworld Effects Manual: setScale()

setScale(float value)

value can be an integer constant, a floating-point constant, or a floating-point variable. Using an integer variable will not cause a crash, but has the same effect as setScale(0), which is not very useful.

setScale() acts on differently on different types of objects:

Effects: Other effects usually call setDefaults() and/or setScale() before creating anything, so setScale() in the calling file will have no effect. It is possible to have a file that does not call setDefaults() at the beginning and thus depends on the calling file for some attributes, but such files are risky. If the calling file does not provide what the file is expecting, it may produce garbage.

Meshes: setScale() multiplies all the dimensions of the mesh by value. So setScale(0.5) will make a 50m long mesh appear 25m long, and so on. Many of the meshes used by Homeworld are 1m across, so setScale() can set their dimensions directly. If value is negative, the mesh is turned inside-out and backwards.

Sprites: setScale() makes sprites value meters across. You can also think of it like this: a sprite is 1m across, and setScale() multiplies its demensions, like it does for meshes. If value is negative, the texture on the sprite is rotated 180 degrees.

Circles: value becomes the radius of the circle. This means that if a circle and a sprite have the same scale, the circle will be twice as wide (and thus have 4 times the area) of the sprite.

Lines: value is the width of the line, in pixels. This does not change as the distance to the camera changes. It also looks different based on the resolution of the screen. So if you run at a low resolution and zoom out, the effect will be overwhelmed by thick, stubby lines. For these reasons, I don't recommend using setScale() with lines.

Points: setScale() affects the size of points in a very limited fashion. Points are either single pixels, 2x2 squares, or 3x3 squares. You can set value to whatever you want, but it will be rounded to either 1, 2, or 3. The size of a point is based on pixels, so, like lines, it is dependant on screen resolution, and not on distance from the camera.