Vector

Return to Introduction  Previous page  Next page

A basic class used to represent a 2D/3D position that can be created with the 'new' keyword.

 

You can construct a Vector by passing 3 floating point coordinates, or copy the values from another Vector object.

 

Properties

 

x

Floating point value representing the x component of the vector.

y

Floating point value representing the y component of the vector.

z

Floating point value representing the z component of the vector.

 

Methods

 

normalize()

Scales the vector to be of unit length.

 

Examples

 

var myPos = new Vector(100,200,300); // create a Vector called myPos representing the position x=100, y=200, z=300.

 

var myPos1 = new Vector(25.7,11.3,19.9);

var myPos2 = new Vector(myPos1); // creates a new Vector with values copied from the first vector

 

See Also

 

Script Reference



Copyright ©2004 Worldweaver Ltd. DX Studio Home