Utilities Class
A static class with functions for performing calculations
Item Index
Methods
centerOfVerts
-
vertcies
Returns a Vector container the center point from a set of vertices
Parameters:
-
vertciesObject
Returns:
xAndY
checkPointCollision
-
testX -
testY -
object
Returns a Vector container the center point from a set of vertices
Parameters:
-
testXNumberX position to be checked
-
testYNumberY position to be checked
-
objectObjectObject to be checked. Takes a Polygon or a Texture
Returns:
isColliding
checkScreenBounds
-
boundX -
boundY -
boundWidth -
boundHeight -
boundXAdditive -
boundYAdditive -
testX -
testY
Checks if an x and y position is within the bounds provided as parameters
Parameters:
-
boundXNumberCamera x position
-
boundYNumberCamera y position
-
boundWidthNumberViewport width
-
boundHeightNumberViewport height
-
boundXAdditiveNumberExtra amount to allow for on x boundaries
-
boundYAdditiveNumberExtra amount to allow for on y boundaries
-
testXNumberThe x position to test
-
testYNumberThe y position to test
Returns:
degToRad
-
degrees
Converts from degrees (angle) to radians
Parameters:
-
degreesNumber
Returns:
radian
minMaxFromVerts
-
vertcies
Returns the minimum width and height and maximum width and height from a set of vertices
Parameters:
-
vertciesObject
Returns:
minAndMax
sizeFromVerts
-
vertcies
Returns the total width and height from a set of vertices
Parameters:
-
vertciesObject
Returns:
widthAndHeight
toMatrix
-
gl -
value -
isWidth
Used to convert pixel positions to WebGL matrix positions
Parameters:
-
glObject -
valueNumber -
isWidthBoolean
Returns:
newValue
vertToMatrix
-
gl -
x -
y
Used to convert pixel positions to WebGL matrix positions
Parameters:
-
glObject -
xNumber -
yNumber
Returns:
newVector
