The Utils3D class contains static methods that simplify the implementation of certain three-dimensional matrix operations.
pointTowards() method allows for in-place modification to the orientation.
It decomposes the Matrix3D of the display object and replaces the rotation
elements by ones that make a percent turn toward the position of the target. The
object can make an incremental turn toward the target while still moving in its
own direction. The consecutive calls to the
pointTowards() followed by a
translation method can produce the animation of an object chasing or following a
moving target. First point the object a percent point toward the target, then
incrementally move the object along an axis.
A Number between 0 and 1 that incrementally turns the object toward the target.
The Matrix3D property of the object that is transformed.
The world-relative position of the target object. World-relative defines the transformation of the object relative to the world space and coordinates, where all objects are positioned.
The object-relative vector that defines where the display object is pointing. Object-relative defines the transformation of the object relative to the object space, the object's own frame of reference and coordinate system. Default value is (0,0,-1).
The object-relative vector that defines "up" for the display object. If the object is drawn looking down from the above, the +z axis is its "up" vector. Object-relative defines the transformation of the object relative to the object space, the object's own frame of reference and coordinate system. Default value is (0,-1,0).
A modified version of the Matrix3D object specified in the second
parameter. To transform the display object using the
pointTowards() method, set
the Matrix3D property of the display object to the returned Matrix3D object.
Using a projection Matrix3D object, projects a Vector of three-dimensional space
verts) to a Vector of two-dimensional space coordinates
projectedVerts). The projected Vector object should be pre-allocated before it
is used as a parameter.
projectVectors() method also sets the t value of the uvt data. You should
pre-allocate a Vector that can hold the uvts data for each projected Vector set of
coordinates. Also specify the u and v values of the uvt data. The uvt data is a
Vector of normalized coordinates used for texture mapping. In UV coordinates,
(0,0) is the upper left of the bitmap, and (1,1) is the lower right of the bitmap.
This method can be used in conjunction with the
and the GraphicsTrianglePath class.
A projection Matrix3D object that implements the projection
transformation. You can produce a projection Matrix3D object using the
A Vector of Floats, where every three Floats represent the x, y,
and z coordinates of a three-dimensional space, like
A vector of Floats, where every two Floats represent a
projected two-dimensional coordinate, like Point(x,y). You should pre-allocate the
A vector of Floats, where every three Floats represent the u, v, and t elements of the uvt data. The u and v are the texture coordinate for each projected point. The t value is the projection depth value, the distance from the eye to the Vector3D object in the view or eye space. You should pre-allocate the Vector and specify the u and v values. The projectVectors method fills the t value for each projected point.