new Cube(x, y, z, widthX, widthY, height) → {Phaser.Plugin.Isometric.Cube}
Parameters:
Name | Type | Description |
---|---|---|
x |
number | The x coordinate of the bottom-back corner of the Cube. |
y |
number | The y coordinate of the bottom-back corner of the Cube. |
z |
number | The z coordinate of the bottom-back corner of the Cube. |
widthX |
number | The X axis width (breadth) of the Cube. Should always be either zero or a positive value. |
widthY |
number | The Y axis width (depth) of the Cube. Should always be either zero or a positive value. |
height |
number | The Z axis height of the Cube. Should always be either zero or a positive value. |
Returns:
This Cube object.
Members
-
backX
-
The x coordinate of the back of the Cube. Changing the backX property of a Cube object has no effect on the y, z, widthY and height properties. However it does affect the widthX property, whereas changing the x value does not affect the width property.
-
backY
-
The y coordinate of the back of the Cube. Changing the backY property of a Cube object has no effect on the x, z, widthX and height properties. However it does affect the widthY property, whereas changing the y value does not affect the width property.
-
bottom
-
The z coordinate of the bottom of the Cube. Changing the bottom property of a Cube object has no effect on the x, y, widthX and widthY properties. However it does affect the height property, whereas changing the z value does not affect the height property.
-
centerX
-
The x coordinate of the center of the Cube.
-
centerY
-
The y coordinate of the center of the Cube.
-
centerZ
-
The z coordinate of the center of the Cube.
-
empty
-
Determines whether or not this Cube object is empty. A Cube object is empty if its widthX, widthY or height is less than or equal to 0. If set to true then all of the Cube properties are set to 0.
-
frontX
-
The sum of the x and widthX properties. Changing the frontX property of a Cube object has no effect on the x, y, z, widthY and height properties, however it does affect the widthX property.
-
frontY
-
The sum of the y and widthY properties. Changing the frontY property of a Cube object has no effect on the x, y, z, widthX and height properties, however it does affect the widthY property.
-
<readonly> halfHeight
-
<readonly> halfWidthX
-
<readonly> halfWidthY
-
height
-
randomX
-
A random value between the frontX and backX values (inclusive) of the Cube.
-
randomY
-
A random value between the frontY and backY values (inclusive) of the Cube.
-
randomZ
-
A random value between the bottom and top values (inclusive) of the Cube.
-
top
-
The sum of the z and height properties. Changing the top property of a Cube object has no effect on the x, y, z, widthX and widthY properties, but does change the height property.
-
<readonly> volume
-
The volume of the Cube derived from widthX widthY height.
-
widthX
-
widthY
-
x
-
y
-
z
Methods
-
<static> clone(a, output) → {Phaser.Plugin.Isometric.Cube}
-
Returns a new Cube object with the same values for the x, y, z, widthX, widthY, and height properties as the original Cube object.
Parameters:
Name Type Argument Description a
Phaser.Plugin.Isometric.Cube The Cube object.
output
Phaser.Plugin.Isometric.Cube <optional>
Optional Cube object. If given the values will be set into the object, otherwise a brand new Cube object will be created and returned.
Returns:
-
<static> contains(a, x, y, z) → {boolean}
-
Determines whether the specified coordinates are contained within the region defined by this Cube object.
Parameters:
Name Type Description a
Phaser.Plugin.Isometric.Cube The Cube object.
x
number The x coordinate of the point to test.
y
number The y coordinate of the point to test.
z
number The z coordinate of the point to test.
Returns:
A value of true if the Cube object contains the specified point; otherwise false.
- Type
- boolean
-
<static> containsCube(a, b) → {boolean}
-
Determines whether the first Cube object is fully contained within the second Cube object. A Cube object is said to contain another if the second Cube object falls entirely within the boundaries of the first.
Parameters:
Name Type Description a
Phaser.Plugin.Isometric.Cube The first Cube object.
b
Phaser.Plugin.Isometric.Cube The second Cube object.
Returns:
A value of true if the Cube object contains the specified point; otherwise false.
- Type
- boolean
-
<static> containsPoint3(a, point3) → {boolean}
-
Determines whether the specified point is contained within the cubic region defined by this Cube object. This method is similar to the Cube.contains() method, except that it takes a Point3 object as a parameter.
Parameters:
Name Type Description a
Phaser.Plugin.Isometric.Cube The Cube object.
point3
Phaser.Plugin.Isometric.Point3 The Point3 object being checked. Can be Point3 or any object with .x, .y and .z values.
Returns:
A value of true if the Cube object contains the specified point; otherwise false.
- Type
- boolean
-
<static> containsXY(a, x, y) → {boolean}
-
Determines whether the specified X and Y coordinates are contained within the region defined by this Cube object.
Parameters:
Name Type Description a
Phaser.Plugin.Isometric.Cube The Cube object.
x
number The x coordinate of the point to test.
y
number The y coordinate of the point to test.
Returns:
A value of true if the Cube object contains the specified point; otherwise false.
- Type
- boolean
-
<static> intersects(a, b) → {boolean}
-
Determines whether the two Cubes intersect with each other. This method checks the x, y, z, widthX, widthY, and height properties of the Cubes.
Parameters:
Name Type Description a
Phaser.Plugin.Isometric.Cube The first Cube object.
b
Phaser.Plugin.Isometric.Cube The second Cube object.
Returns:
A value of true if the specified object intersects with this Cube object; otherwise false.
- Type
- boolean
-
<static> size(a, output) → {Phaser.Plugin.Isometric.Point3}
-
The size of the Cube object, expressed as a Point3 object with the values of the widthX, widthY and height properties.
Parameters:
Name Type Argument Description a
Phaser.Plugin.Isometric.Cube The Cube object.
output
Phaser.Plugin.Isometric.Point3 <optional>
Optional Point3 object. If given the values will be set into the object, otherwise a brand new Point3 object will be created and returned.
Returns:
The size of the Cube object
-
clone(output) → {Phaser.Plugin.Isometric.Cube}
-
Returns a new Cube object with the same values for the x, y, z, widthX, widthY and height properties as the original Cube object.
Parameters:
Name Type Argument Description output
Phaser.Plugin.Isometric.Cube <optional>
Optional Cube object. If given the values will be set into the object, otherwise a brand new Cube object will be created and returned.
Returns:
-
contains(x, y, y) → {boolean}
-
Determines whether the specified coordinates are contained within the region defined by this Cube object.
Parameters:
Name Type Description x
number The x coordinate of the point to test.
y
number The y coordinate of the point to test.
y
number The z coordinate of the point to test.
Returns:
A value of true if the Cube object contains the specified point; otherwise false.
- Type
- boolean
-
containsXY(x, y) → {boolean}
-
Determines whether the specified X and Y coordinates are contained within the region defined by this Cube object.
Parameters:
Name Type Description x
number The x coordinate of the point to test.
y
number The y coordinate of the point to test.
Returns:
A value of true if this Cube object contains the specified point; otherwise false.
- Type
- boolean
-
copyFrom(source) → {Phaser.Plugin.Isometric.Cube}
-
Copies the x, y, z, widthX, widthY and height properties from any given object to this Cube.
Parameters:
Name Type Description source
any The object to copy from.
Returns:
This Cube object.
-
copyTo(dest) → {Phaser.Plugin.Isometric.Cube}
-
Copies the x, y, z, widthX, widthY and height properties from this Cube to any given object.
Parameters:
Name Type Description dest
any The object to copy to.
Returns:
This Cube object.
-
getCorners() → {Array.<Phaser.Plugin.Isometric.Point3>}
-
Updates and returns an Array of eight Point3 objects containing the corners of this Cube.
Returns:
The corners of this Cube expressed as an Array of eight Point3 objects.
- Type
- Array.<Phaser.Plugin.Isometric.Point3>
-
intersects(b) → {boolean}
-
Determines whether the two Cubes intersect with each other. This method checks the x, y, z, widthX, widthY, and height properties of the Cubes.
Parameters:
Name Type Description b
Phaser.Plugin.Isometric.Cube The second Cube object.
Returns:
A value of true if the specified object intersects with this Cube object; otherwise false.
- Type
- boolean
-
setTo(x, y, z, widthX, widthY, height) → {Phaser.Plugin.Isometric.Cube}
-
Sets the members of Cube to the specified values.
Parameters:
Name Type Description x
number The x coordinate of the bottom-back corner of the Cube.
y
number The y coordinate of the bottom-back corner of the Cube.
z
number The z coordinate of the bottom-back corner of the Cube.
widthX
number The X axis width (breadth) of the Cube. This value should never be set to a negative.
widthY
number The Y axis width (depth) of the Cube. This value should never be set to a negative.
height
number The Z axis height of the Cube. This value should never be set to a negative.
Returns:
This Cube object
-
size(output) → {Phaser.Plugin.Isometric.Point3}
-
The size of the Cube object, expressed as a Point3 object with the values of the widthX, widthY and height properties.
Parameters:
Name Type Argument Description output
Phaser.Plugin.Isometric.Point3 <optional>
Optional Point3 object. If given the values will be set into the object, otherwise a brand new Point3 object will be created and returned.
Returns:
The size of the Cube object.
-
toString() → {string}
-
Returns a string representation of this object.
Returns:
A string representation of the instance.
- Type
- string