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:
-
vertcies
Object
Returns:
xAndY
checkPointCollision
-
testX
-
testY
-
object
Returns a Vector container the center point from a set of vertices
Parameters:
-
testX
NumberX position to be checked
-
testY
NumberY position to be checked
-
object
ObjectObject 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:
-
boundX
NumberCamera x position
-
boundY
NumberCamera y position
-
boundWidth
NumberViewport width
-
boundHeight
NumberViewport height
-
boundXAdditive
NumberExtra amount to allow for on x boundaries
-
boundYAdditive
NumberExtra amount to allow for on y boundaries
-
testX
NumberThe x position to test
-
testY
NumberThe y position to test
Returns:
degToRad
-
degrees
Converts from degrees (angle) to radians
Parameters:
-
degrees
Number
Returns:
radian
minMaxFromVerts
-
vertcies
Returns the minimum width and height and maximum width and height from a set of vertices
Parameters:
-
vertcies
Object
Returns:
minAndMax
sizeFromVerts
-
vertcies
Returns the total width and height from a set of vertices
Parameters:
-
vertcies
Object
Returns:
widthAndHeight
toMatrix
-
gl
-
value
-
isWidth
Used to convert pixel positions to WebGL matrix positions
Parameters:
-
gl
Object -
value
Number -
isWidth
Boolean
Returns:
newValue
vertToMatrix
-
gl
-
x
-
y
Used to convert pixel positions to WebGL matrix positions
Parameters:
-
gl
Object -
x
Number -
y
Number
Returns:
newVector