new Body(sprite)
Parameters:
| Name | Type | Description |
|---|---|---|
sprite |
Phaser.Plugin.Isometric.IsoSprite | The IsoSprite object this physics body belongs to. |
- Source:
Members
-
acceleration
-
- Source:
Properties:
Name Type Description accelerationPhaser.Plugin.Isometric.Point3 The velocity in pixels per second sq. of the Body.
-
allowGravity
-
- Default Value:
-
- true
- Source:
Properties:
Name Type Description allowGravityboolean Allow this Body to be influenced by gravity? Either world or local.
-
allowRotation
-
- Default Value:
-
- true
- Source:
Properties:
Name Type Description allowRotationboolean Allow this Body to be rotated? (via angularVelocity, etc)
-
<readonly> angle
-
- Source:
Properties:
Name Type Description anglenumber The angle of the Body in radians as calculated by its velocity, rather than its visual angle.
-
angularAcceleration
-
- Default Value:
-
- 0
- Source:
Properties:
Name Type Description angularAccelerationnumber The angular acceleration in pixels per second sq. of the Body.
-
angularDrag
-
- Default Value:
-
- 0
- Source:
Properties:
Name Type Description angularDragnumber The angular drag applied to the rotation of the Body.
-
angularVelocity
-
- Default Value:
-
- 0
- Source:
Properties:
Name Type Description angularVelocitynumber The angular velocity in pixels per second sq. of the Body.
-
blocked
-
This object is populated with boolean values when the Body collides with the World bounds or a Tile. For example if blocked.up is true then the Body cannot move up.
- Source:
Properties:
Name Type Description blockedobject An object containing on which faces this Body is blocked from moving, if any.
-
<readonly> bottom
-
- Source:
Properties:
Name Type Description rightnumber The front Y value of this Body (same as Body.y + Body.widthY) - alias used for QuadTree
-
bounce
-
- Source:
Properties:
Name Type Description bouncePhaser.Plugin.Isometric.Point3 The elasticitiy of the Body when colliding. bounce.x/y/z = 1 means full rebound, bounce.x/y/z = 0.5 means 50% rebound velocity.
-
center
-
- Source:
Properties:
Name Type Description centerPhaser.Plugin.Isometric.Point3 The center coordinate of the physics body.
-
checkCollision
-
Set the checkCollision properties to control which directions collision is processed for this Body. For example checkCollision.up = false means it won't collide when the collision happened while moving up.
- Source:
Properties:
Name Type Description checkCollisionobject An object containing allowed collision.
-
collideWorldBounds
-
A Body can be set to collide against the World bounds automatically and rebound back into the World if this is set to true. Otherwise it will leave the World.
- Source:
Properties:
Name Type Description collideWorldBoundsboolean Should the Body collide with the World bounds?
-
customSeparateX
-
This flag allows you to disable the custom x separation that takes place by Physics.IsoArcade.separate. Used in combination with your own collision processHandler you can create whatever type of collision response you need.
- Default Value:
-
- false
- Source:
Properties:
Name Type Description customSeparateXboolean Use a custom separation system or the built-in one?
-
customSeparateY
-
This flag allows you to disable the custom y separation that takes place by Physics.IsoArcade.separate. Used in combination with your own collision processHandler you can create whatever type of collision response you need.
- Default Value:
-
- false
- Source:
Properties:
Name Type Description customSeparateYboolean Use a custom separation system or the built-in one?
-
customSeparateZ
-
This flag allows you to disable the custom z separation that takes place by Physics.IsoArcade.separate. Used in combination with your own collision processHandler you can create whatever type of collision response you need.
- Default Value:
-
- false
- Source:
Properties:
Name Type Description customSeparateZboolean Use a custom separation system or the built-in one?
-
deltaMax
-
- Source:
Properties:
Name Type Description deltaMaxPhaser.Plugin.Isometric.Point3 The Sprite position is updated based on the delta x/y values. You can set a cap on those (both +-) using deltaMax.
-
drag
-
- Source:
Properties:
Name Type Description dragPhaser.Plugin.Isometric.Point3 The drag applied to the motion of the Body.
-
embedded
-
If a body is overlapping with another body, but neither of them are moving (maybe they spawned on-top of each other?) this is set to true.
- Source:
Properties:
Name Type Description embeddedboolean Body embed value.
-
enable
-
- Default Value:
-
- true
- Source:
Properties:
Name Type Description enableboolean A disabled body won't be checked for any form of collision or overlap or have its pre/post updates run.
-
facing
-
- Source:
Properties:
Name Type Description facingnumber A const reference to the direction the Body is traveling or facing.
-
<readonly> frontX
-
- Source:
Properties:
Name Type Description rightnumber The front X value of this Body (same as Body.x + Body.widthX)
-
<readonly> frontY
-
- Source:
Properties:
Name Type Description rightnumber The front Y value of this Body (same as Body.y + Body.widthY)
-
game
-
- Source:
Properties:
Name Type Description gamePhaser.Game Local reference to game.
-
gravity
-
- Source:
Properties:
Name Type Description gravityPhaser.Plugin.Isometric.Point3 A local gravity applied to this Body. If non-zero this over rides any world gravity, unless Body.allowGravity is set to false.
-
halfHeight
-
- Source:
Properties:
Name Type Description halfHeightnumber The calculated height / 2 of the physics body.
-
halfWidthX
-
- Source:
Properties:
Name Type Description halfWidthXnumber The calculated X width / 2 of the physics body.
-
halfWidthY
-
- Source:
Properties:
Name Type Description halfWidthXnumber The calculated X width / 2 of the physics body.
-
height
-
- Source:
Properties:
Name Type Description heightnumber The calculated height of the physics body.
-
immovable
-
- Default Value:
-
- false
- Source:
Properties:
Name Type Description immovableboolean An immovable Body will not receive any impacts from other bodies.
-
mass
-
- Default Value:
-
- 1
- Source:
Properties:
Name Type Description massnumber The mass of the Body.
-
maxAngular
-
- Default Value:
-
- 1000
- Source:
Properties:
Name Type Description maxAngularnumber The maximum angular velocity in pixels per second sq. that the Body can reach.
-
maxVelocity
-
- Source:
Properties:
Name Type Description maxVelocityPhaser.Plugin.Isometric.Point3 The maximum velocity in pixels per second sq. that the Body can reach.
-
moves
-
If you have a Body that is being moved around the world via a tween or a Group motion, but its local x/y position never actually changes, then you should set Body.moves = false. Otherwise it will most likely fly off the screen. If you want the physics system to move the body around, then set moves to true.
- Default Value:
-
- true
- Source:
Properties:
Name Type Description movesboolean Set to true to allow the Physics system to move this Body, other false to move it manually.
-
<readonly> newVelocity
-
- Source:
Properties:
Name Type Description newVelocityPhaser.Plugin.Isometric.Point3 New velocity.
-
offset
-
- Source:
Properties:
Name Type Description offsetPhaser.Point The offset of the Physics Body from the IsoSprite x/y/z position.
-
overlapX
-
When this body collides with another, the amount of overlap is stored here.
- Source:
Properties:
Name Type Description overlapXnumber The amount of horizontal overlap during the collision.
-
overlapY
-
When this body collides with another, the amount of overlap is stored here.
- Source:
Properties:
Name Type Description overlapYnumber The amount of vertical overlap during the collision.
-
overlapZ
-
When this body collides with another, the amount of overlap is stored here.
- Source:
Properties:
Name Type Description overlapYnumber The amount of vertical overlap during the collision.
-
phase
-
- Source:
Properties:
Name Type Description phasenumber Is this Body in a preUpdate (1) or postUpdate (2) state?
-
<readonly> position
-
- Source:
Properties:
Name Type Description positionPhaser.Plugin.Isometric.Point3 The position of the physics body.
-
<readonly> preRotation
-
- Source:
Properties:
Name Type Description preRotationnumber The previous rotation of the physics body.
-
<readonly> prev
-
- Source:
Properties:
Name Type Description prevPhaser.Point The previous position of the physics body.
-
<readonly> right
-
- Source:
Properties:
Name Type Description rightnumber The front X value of this Body (same as Body.x + Body.widthX) - alias used for QuadTree
-
rotation
-
- Source:
Properties:
Name Type Description rotationnumber The amount the Body is rotated.
-
skipTree
-
- Source:
Properties:
Name Type Description skipTreeboolean If true and you collide this IsoSprite against a Group, it will disable the collision check from using a QuadTree/Octree.
-
<readonly> sourceHeight
-
- Source:
Properties:
Name Type Description sourceHeightnumber The un-scaled original size.
-
<readonly> sourceWidthX
-
- Source:
Properties:
Name Type Description sourceWidthXnumber The un-scaled original size.
-
<readonly> sourceWidthY
-
- Source:
Properties:
Name Type Description sourceWidthYnumber The un-scaled original size.
-
<readonly> speed
-
- Source:
Properties:
Name Type Description speednumber The speed of the Body as calculated by its velocity.
-
sprite
-
- Source:
Properties:
Name Type Description spritePhaser.Plugin.Isometric.IsoSprite Reference to the parent IsoSprite.
-
<readonly> top
-
- Source:
Properties:
Name Type Description bottomnumber The top value of this Body (same as Body.z + Body.height)
-
touching
-
This object is populated with boolean values when the Body collides with another. touching.up = true means the collision happened to the top of this Body for example.
- Source:
Properties:
Name Type Description touchingobject An object containing touching results.
-
type
-
- Source:
Properties:
Name Type Description typenumber The type of physics system this body belongs to.
-
velocity
-
- Source:
Properties:
Name Type Description velocityPhaser.Plugin.Isometric.Point3 The velocity in pixels per second sq. of the Body.
-
wasTouching
-
This object is populated with previous touching values from the bodies previous collision.
- Source:
Properties:
Name Type Description wasTouchingobject An object containing previous touching results.
-
widthX
-
- Source:
Properties:
Name Type Description widthXnumber The calculated X width (breadth) of the physics body.
-
widthY
-
- Source:
Properties:
Name Type Description widthYnumber The calculated Y width (depth) of the physics body.
-
x
-
- Source:
Properties:
Name Type Description xnumber The x position.
-
y
-
- Source:
Properties:
Name Type Description ynumber The y position.
-
z
-
- Source:
Properties:
Name Type Description znumber The z position.
Methods
-
<protected> checkWorldBounds()
-
Internal method.
- Source:
-
deltaAbsX() → {number}
-
Returns the absolute delta x value.
- Source:
Returns:
The absolute delta value.
- Type
- number
-
deltaAbsY() → {number}
-
Returns the absolute delta y value.
- Source:
Returns:
The absolute delta value.
- Type
- number
-
deltaAbsZ() → {number}
-
Returns the absolute delta z value.
- Source:
Returns:
The absolute delta value.
- Type
- number
-
deltaR() → {number}
-
Returns the delta r value. The difference between Body.rotation now and in the previous step.
- Source:
Returns:
The delta value. Positive if the motion was clockwise, negative if anti-clockwise.
- Type
- number
-
deltaX() → {number}
-
Returns the delta x value. The difference between Body.x now and in the previous step.
- Source:
Returns:
The delta value. Positive if the motion was to the right, negative if to the left.
- Type
- number
-
deltaY() → {number}
-
Returns the delta y value. The difference between Body.y now and in the previous step.
- Source:
Returns:
The delta value. Positive if the motion was downwards, negative if upwards.
- Type
- number
-
deltaZ() → {number}
-
Returns the delta z value. The difference between Body.z now and in the previous step.
- Source:
Returns:
The delta value. Positive if the motion was downwards, negative if upwards.
- Type
- number
-
destroy()
-
Removes this body's reference to its parent sprite, freeing it up for gc.
- Source:
-
getCorners() → {Array.<Phaser.Plugin.Isometric.Point3>}
-
Returns the 8 corners that make up the body's bounding cube.
- Source:
Returns:
An array of Phaser.Plugin.Isometric.Point3 values specifying each corner co-ordinate.
- Type
- Array.<Phaser.Plugin.Isometric.Point3>
-
hitTest(x, y, z) → {boolean}
-
Tests if a world point lies within this Body.
Parameters:
Name Type Description xnumber The world x coordinate to test.
ynumber The world y coordinate to test.
znumber The world z coordinate to test.
- Source:
Returns:
True if the given coordinates are inside this Body, otherwise false.
- Type
- boolean
-
onFloor() → {boolean}
-
Returns true if the bottom of this Body is in contact with either the world bounds.
- Source:
Returns:
True if in contact with either the world bounds.
- Type
- boolean
-
onWall() → {boolean}
-
Returns true if either side of this Body is in contact with either the world bounds.
- Source:
Returns:
True if in contact with world bounds.
- Type
- boolean
-
<protected> postUpdate()
-
Internal method.
- Source:
-
<protected> preUpdate()
-
Internal method.
- Source:
-
render(context, body, color, filled)
-
Render IsoSprite Body.
Parameters:
Name Type Argument Default Description contextobject The context to render to.
bodyPhaser.Plugin.Isometric.Body The Body to render the info of.
colorstring <optional>
'rgba(0,255,0,0.4)' color of the debug info to be rendered. (format is css color string).
filledboolean <optional>
true Render the objected as a filled (default, true) or a stroked (false)
- Source:
-
renderBodyInfo(body, x, y, color)
-
Render IsoSprite Body Physics Data as text.
Parameters:
Name Type Argument Default Description bodyPhaser.Plugin.Isometric.Body The Body to render the info of.
xnumber X position of the debug info to be rendered.
ynumber Y position of the debug info to be rendered.
colorstring <optional>
'rgb(255,255,255)' color of the debug info to be rendered. (format is css color string).
- Source:
-
reset(x, y, z)
-
Resets all Body values (velocity, acceleration, rotation, etc)
Parameters:
Name Type Description xnumber The new x position of the Body.
ynumber The new y position of the Body.
znumber The new z position of the Body.
- Source:
-
setSize(widthX, widthY, height, offsetX, offsetY, offsetY)
-
You can modify the size of the physics Body to be any dimension you need. So it could be smaller or larger than the parent Sprite. You can also control the x, y and z offset, which is the position of the Body relative to the center of the Sprite.
Parameters:
Name Type Argument Description widthXnumber The X width (breadth) of the Body.
widthYnumber The Y width (depth) of the Body.
heightnumber The height of the Body.
offsetXnumber <optional>
The X offset of the Body from the Sprite position.
offsetYnumber <optional>
The Y offset of the Body from the Sprite position.
offsetYnumber <optional>
The Z offset of the Body from the Sprite position.
- Source:
-
<protected> updateBounds()
-
Internal method.
- Source: