RotationMath.<...>

Return to Introduction  Previous page  Next page

A collection of useful mathematical functions for manipulation of rotations.

 

Methods

 

combine(rotation, rotation)

Combines (i.e. multiplies) two rotations together to produce a new rotation.

fromUpVectorAndAngle(upvector, angle)

Returns a Rotation given an 'up' Vector and a floating point angle to finally rotate about that Vector in degrees.

fromForwardVectorAndAngle(fwdvector, angle)

Returns a Rotation given a Vector pointing 'forwards' and a floating point angle to finally rotate around that Vector in degrees.

orbitRotHeading(anglearound, angleevelation)

Returns a Rotation from two floating point values defining the angle around the target (degrees) and the elevation above the target (degrees).  Used with VectorMath.orbitPos to set the position.  If anglearound is zero, you're looking along the Z axis.

headingDegrees(rotation)

Returns an angle in degrees that is the direction in which an object with the given rotation is facing (0 degrees is along Z axis)

elevationDegrees(rotation)

Returns an angle in degrees that is the angle relative to the horizon that an object with given rotation is facing (0 degrees is along horizon, +20 is looking 20 degrees below the horizon).

rollDegrees(rotation)

Returns an angle in degrees that is the direction in which an object with the given rotation is rolled (0 degrees is no roll).

lookAtRot(vectorFrom, vectorAt)

Returns a Rotation given a Vector you're looking from and a Vector you're looking at.

inverseRot(rotation)

Returns a new Rotation that is the inverse of the given Rotation.

       

Examples

 

var rot1=new Rotation(0,10,0);

var rot2=new Rotation(45,0,0);

var result=RotationMath.add(rot1,rot2);

 

See Also

 

Script Reference



Copyright ©2004 Worldweaver Ltd. DX Studio Home