User Guide

rawNew() 491
Example
These statements create and display two randomly defined unit vectors in the Message window:
-- Lingo syntax
vec1 = randomVector()
vec2 = randomVector()
put(vec1 & RETURN & vec2)
// JavaScript syntax
var vec1 = randomVector();
var vec2 = randomVector();
put(vec1 + "\n" + vec2);
See also
vector()
randomVector
Usage
randomVector()
Description
3D command; returns a unit vector describing a randomly chosen point on the surface of a unit
sphere. This method differs from
vector( random(10)/10.0, random(10)/10.0,
random(10)/10.0), in that the resulting vector is guaranteed to be a unit vector.
Parameters
None.
Example
These statements create and display two randomly defined unit vectors in the Message window:
vec = randomVector()
put vec
-- vector(-0.1155, 0.9833, -0.1408)
vec2 = randomVector()
put vec2
-- vector(0.0042, 0.8767, 0.4810)
See also
getNormalized, generateNormals(), normalize
rawNew()
Usage
parentScript.rawNew()
rawNew(parentScript)
Description
Function; creates a child object from a parent script without calling its on new handler. This
allows a movie to create child objects without initializing the properties of those child objects.
This is particularly useful when you want to create large numbers of child objects for later use. To
initialize the properties of one of these raw child objects, call its
on new handler.