arcade-physics
Version:
Use Arcade Physics without Phaser.
955 lines • 34.9 kB
TypeScript
/**
* @author Richard Davey <rich@photonstorm.com>
* @author Benjamin D. Richards <benjamindrichards@gmail.com>
* @copyright 2020 Photon Storm Ltd.
* @license {@link https://opensource.org/licenses/MIT|MIT License}
*/
import { FACING, PHYSICS_TYPE } from './const';
import { Rectangle } from '../../geom/rectangle/Rectangle';
import { Vector2 } from '../../math/Vector2';
import { World } from './World';
/** A Dynamic Arcade Body. */
export declare class Body {
/** The Arcade Physics simulation this Body belongs to. */
world: World;
/** Whether the Body is drawn to the debug display. */
debugShowBody: boolean;
/** Whether the Body's velocity is drawn to the debug display. */
debugShowVelocity: boolean;
/** The color of this Body on the debug display. */
debugBodyColor: number;
/** Whether this Body is updated by the physics simulation. */
enable: boolean;
/** Whether this Body is circular (true) or rectangular (false). */
isCircle: boolean;
/**
* If this Body is circular, this is the unscaled radius of the Body, as set by setCircle(), in source pixels.
* The true radius is equal to `halfWidth`.
*/
radius: number;
/** The position of this Body within the simulation. */
position: Vector2;
/** The position of this Body during the previous step. */
prev: Vector2;
/** The position of this Body during the previous frame. */
prevFrame: Vector2;
/** Whether this Body's `rotation` is affected by its angular acceleration and angular velocity. */
allowRotation: boolean;
/**
* This body's rotation, in degrees, based on its angular acceleration and angular velocity.
* The Body's rotation controls the `angle` of its Game Object.
* It doesn't rotate the Body's own geometry, which is always an axis-aligned rectangle or a circle.
*/
rotation: number;
/** The Body rotation, in degrees, during the previous step. */
preRotation: number;
/**
* The width of the Body, in pixels.
* If the Body is circular, this is also the diameter.
* If you wish to change the width use the `Body.setSize` method.
*/
width: number;
/**
* The height of the Body, in pixels.
* If the Body is circular, this is also the diameter.
* If you wish to change the height use the `Body.setSize` method.
*/
height: number;
/**
* The unscaled width of the Body, in source pixels, as set by setSize().
* The default is the width of the Body's Game Object's texture frame.
*/
sourceWidth: number;
/**
* The unscaled height of the Body, in source pixels, as set by setSize().
* The default is the height of the Body's Game Object's texture frame.
*/
sourceHeight: number;
/** Half the Body's width, in pixels. */
halfWidth: number;
/** Half the Body's height, in pixels. */
halfHeight: number;
/**
* The center of the Body.
* The midpoint of its `position` (top-left corner) and its bottom-right corner.
*/
center: Vector2;
/** The Body's velocity, in pixels per second. */
velocity: Vector2;
/**
* The Body's change in position (due to velocity) at the last step, in pixels.
*
* The size of this value depends on the simulation's step rate.
*/
newVelocity: Vector2;
/** The Body's absolute maximum change in position, in pixels per step. */
deltaMax: Vector2;
/** The Body's change in velocity, in pixels per second squared. */
acceleration: Vector2;
/** Whether this Body's velocity is affected by its `drag`. */
allowDrag: boolean;
/**
* When `useDamping` is false (the default), this is absolute loss of velocity due to movement, in pixels per second squared.
*
* When `useDamping` is true, this is a damping multiplier between 0 and 1.
* A value of 0 means the Body stops instantly.
* A value of 0.01 mean the Body keeps 1% of its velocity per second, losing 99%.
* A value of 0.1 means the Body keeps 10% of its velocity per second, losing 90%.
* A value of 1 means the Body loses no velocity.
* You can use very small values (e.g., 0.001) to stop the Body quickly.
*
* The x and y components are applied separately.
*
* Drag is applied only when `acceleration` is zero.
*/
drag: Vector2;
/** Whether this Body's position is affected by gravity (local or world). */
allowGravity: boolean;
/**
* Acceleration due to gravity (specific to this Body), in pixels per second squared.
* Total gravity is the sum of this vector and the simulation's `gravity`.
*/
gravity: Vector2;
/** Rebound following a collision, relative to 1. */
bounce: Vector2;
/**
* Rebound following a collision with the world boundary, relative to 1.
* If null, `bounce` is used instead.
*/
worldBounce: Vector2 | null;
/**
* The rectangle used for world boundary collisions.
*
* By default it is set to the world boundary rectangle. Or, if this Body was
* created by a Physics Group, then whatever rectangle that Group defined.
*
* You can also change it by using the `Body.setBoundsRectangle` method.
*/
customBoundsRectangle: Rectangle;
/** Whether the simulation emits a `worldbounds` event when this Body collides with the world boundary (and `collideWorldBounds` is also true). */
onWorldBounds: boolean;
/** Whether the simulation emits a `collide` event when this Body collides with another. */
onCollide: boolean;
/** Whether the simulation emits an `overlap` event when this Body overlaps with another. */
onOverlap: boolean;
/**
* The Body's absolute maximum velocity, in pixels per second.
* The horizontal and vertical components are applied separately.
*/
maxVelocity: Vector2;
/**
* The maximum speed this Body is allowed to reach, in pixels per second.
*
* If not negative it limits the scalar value of speed.
*
* Any negative value means no maximum is being applied (the default).
*/
maxSpeed: number;
/**
* If this Body is `immovable` and in motion, `friction` is the proportion of this Body's motion received by the riding Body on each axis, relative to 1.
* The horizontal component (x) is applied only when two colliding Bodies are separated vertically.
* The vertical component (y) is applied only when two colliding Bodies are separated horizontally.
* The default value (1, 0) moves the riding Body horizontally in equal proportion to this Body and vertically not at all.
*/
friction: Vector2;
/**
* If this Body is using `drag` for deceleration this property controls how the drag is applied.
* If set to `true` drag will use a damping effect rather than a linear approach. If you are
* creating a game where the Body moves freely at any angle (i.e. like the way the ship moves in
* the game Asteroids) then you will get a far smoother and more visually correct deceleration
* by using damping, avoiding the axis-drift that is prone with linear deceleration.
*
* If you enable this property then you should use far smaller `drag` values than with linear, as
* they are used as a multiplier on the velocity. Values such as 0.05 will give a nice slow
* deceleration.
*/
useDamping: boolean;
/** The rate of change of this Body's `rotation`, in degrees per second. */
angularVelocity: number;
/** The Body's angular acceleration (change in angular velocity), in degrees per second squared. */
angularAcceleration: number;
/**
* Loss of angular velocity due to angular movement, in degrees per second.
*
* Angular drag is applied only when angular acceleration is zero.
*/
angularDrag: number;
/** The Body's maximum angular velocity, in degrees per second. */
maxAngular: number;
/**
* The Body's inertia, relative to a default unit (1).
* With `bounce`, this affects the exchange of momentum (velocities) during collisions.
*/
mass: number;
/** The calculated angle of this Body's velocity vector, in radians, during the last step. */
angle: number;
/** The calculated magnitude of the Body's velocity, in pixels per second, during the last step. */
speed: number;
/**
* The direction of the Body's velocity, as calculated during the last step.
* This is a numeric constant value (FACING_UP, FACING_DOWN, FACING_LEFT, FACING_RIGHT).
* If the Body is moving on both axes, this describes motion on the vertical axis only.
*/
facing: FACING;
/** Whether this Body can be moved by collisions with another Body. */
immovable: boolean;
/**
* Sets if this Body can be pushed by another Body.
*
* A body that cannot be pushed will reflect back all of the velocity it is given to the
* colliding body. If that body is also not pushable, then the separation will be split
* between them evenly.
*
* If you want your body to never move or seperate at all, see the `setImmovable` method.
*
* By default, Dynamic Bodies are always pushable.
*/
pushable: boolean;
/** Whether the Body's position and rotation are affected by its velocity, acceleration, drag, and gravity. */
moves: boolean;
/**
* A flag disabling the default horizontal separation of colliding bodies.
* Pass your own `collideCallback` to the collider.
*/
customSeparateX: boolean;
/**
* A flag disabling the default vertical separation of colliding bodies.
* Pass your own `collideCallback` to the collider.
*/
customSeparateY: boolean;
/** The amount of horizontal overlap (before separation), if this Body is colliding with another. */
overlapX: number;
/** The amount of vertical overlap (before separation), if this Body is colliding with another. */
overlapY: number;
/** The amount of overlap (before separation), if this Body is circular and colliding with another circular body. */
overlapR: number;
/** Whether this Body is overlapped with another and both are not moving, on at least one axis. */
embedded: boolean;
/** Whether this Body interacts with the world boundary. */
collideWorldBounds: boolean;
/**
* Whether this Body is checked for collisions and for which directions.
* You can set `checkCollision.none = true` to disable collision checks.
*/
checkCollision: {
none: boolean;
up: boolean;
down: boolean;
left: boolean;
right: boolean;
};
/**
* Whether this Body is colliding with a Body or Static Body and in which direction.
* In a collision where both bodies have zero velocity, `embedded` will be set instead.
*/
touching: {
none: boolean;
up: boolean;
down: boolean;
left: boolean;
right: boolean;
};
/** This Body's `touching` value during the previous step. */
wasTouching: {
none: boolean;
up: boolean;
down: boolean;
left: boolean;
right: boolean;
};
/**
* Whether this Body is colliding with a Static Body, a tile, or the world boundary.
* In a collision with a Static Body, if this Body has zero velocity then `embedded` will be set instead.
*/
blocked: {
none: boolean;
up: boolean;
down: boolean;
left: boolean;
right: boolean;
};
/** The Body's physics type (dynamic or static). */
physicsType: PHYSICS_TYPE;
/** Cached horizontal scale of the Body's Game Object. */
private _sx;
/** Cached vertical scale of the Body's Game Object. */
private _sy;
/** The calculated change in the Body's horizontal position during the last step. */
private _dx;
/** The calculated change in the Body's vertical position during the last step. */
private _dy;
/** The final calculated change in the Body's horizontal position as of `postUpdate`. */
private _tx;
/** The final calculated change in the Body's vertical position as of `postUpdate`. */
private _ty;
/** Stores the Game Object's bounds. */
private _bounds;
isBody: boolean;
constructor(world: World, x: number, y: number, width?: number, height?: number);
get minX(): number;
get minY(): number;
get maxX(): number;
get maxY(): number;
/** Updates the Body's `center` from its `position`, `width`, and `height`. */
updateCenter(): void;
/**
* Prepares the Body for a physics step by resetting the `wasTouching`, `touching` and `blocked` states.
*
* This method is only called if the physics world is going to run a step this frame.
*/
resetFlags(clear?: boolean): void;
/**
* Syncs the position body position with the parent Game Object.
*
* This method is called every game frame, regardless if the world steps or not.
*
* @param willStep - Will this Body run an update as well?
* @param delta - The delta time, in seconds, elapsed since the last frame.
*/
preUpdate(willStep: boolean, delta: number): void;
/**
* Performs a single physics step and updates the body velocity, angle, speed and other properties.
*
* This method can be called multiple times per game frame, depending on the physics step rate.
*
* The results are synced back to the Game Object in `postUpdate`.
*
* @param delta - The delta time, in seconds, elapsed since the last frame.
*/
update(delta: number): void;
/**
* Feeds the Body results back into the parent Game Object.
*
* This method is called every game frame, regardless if the world steps or not.
*/
postUpdate(): void;
/**
* Sets a custom collision boundary rectangle. Use if you want to have a custom
* boundary instead of the world boundaries.
*
* @param bounds - The new boundary rectangle. Pass `null` to use the World bounds.
*/
setBoundsRectangle(bounds?: Rectangle): this;
/**
* Checks for collisions between this Body and the world boundary and separates them.
*
* Returns true if this Body is colliding with the world boundary.
*/
checkWorldBounds(): boolean;
/**
* Sizes and positions this Body, as a rectangle.
*
* @param width - The width of the Body in pixels. Cannot be zero.
* @param height - The height of the Body in pixels. Cannot be zero.
*/
setSize(width: number, height: number): this;
/**
* Sizes and positions this Body, as a circle.
*
* @param radius - The radius of the Body, in source pixels.
*/
setCircle(radius: number): this;
/**
* Resets this Body at the new coordinates.
* If the Body had any velocity or acceleration it is lost as a result of calling this.
*
* @param x - The horizontal position to place the Body.
* @param y - The vertical position to place the Body.
*/
reset(x: number, y: number): void;
/** Sets acceleration, velocity, and speed to zero. */
stop(): this;
/**
* Copies the coordinates of this Body's edges into an object.
*
* @param {Phaser.Types.Physics.Arcade.ArcadeBodyBounds} obj - An object to copy the values into.
*
* @return {Phaser.Types.Physics.Arcade.ArcadeBodyBounds} - An object with {x, y, right, bottom}.
*/
getBounds(obj: any): any;
/**
* Tests if the coordinates are within this Body.
*
* Returns true if (x, y) is within this Body.
*
* @param x - The horizontal coordinate.
* @param y - The vertical coordinate.
*/
hitTest(x: number, y: number): boolean;
/**
* Whether this Body is touching a tile or the world boundary while moving down.
*
* Returns true if touching.
*/
onFloor(): boolean;
/**
* Whether this Body is touching a tile or the world boundary while moving up.
*
* Returns true if touching.
*/
onCeiling(): boolean;
/**
* Whether this Body is touching a tile or the world boundary while moving left or right.
*
* Returns true if touching.
*/
onWall(): boolean;
/**
* The absolute (non-negative) change in this Body's horizontal position from the previous step.
*
* Returns the delta value.
*/
deltaAbsX(): number;
/**
* The absolute (non-negative) change in this Body's vertical position from the previous step.
*
* Returns the delta value.
*/
deltaAbsY(): number;
/**
* The change in this Body's horizontal position from the previous step.
* This value is set during the Body's update phase.
*
* As a Body can update multiple times per step this may not hold the final
* delta value for the Body. In this case, please see the `deltaXFinal` method.
*
* Returns the delta value.
*/
deltaX(): number;
/**
* The change in this Body's vertical position from the previous step.
* This value is set during the Body's update phase.
*
* As a Body can update multiple times per step this may not hold the final
* delta value for the Body. In this case, please see the `deltaYFinal` method.
*
* Returns the delta value.
*/
deltaY(): number;
/**
* The change in this Body's horizontal position from the previous game update.
*
* This value is set during the `postUpdate` phase and takes into account the
* `deltaMax` and final position of the Body.
*
* Because this value is not calculated until `postUpdate`, you must listen for it
* during a Scene `POST_UPDATE` or `RENDER` event, and not in `update`, as it will
* not be calculated by that point. If you _do_ use these values in `update` they
* will represent the delta from the _previous_ game frame.
*
* Returns the final delta x value.
*/
deltaXFinal(): number;
/**
* The change in this Body's vertical position from the previous game update.
*
* This value is set during the `postUpdate` phase and takes into account the
* `deltaMax` and final position of the Body.
*
* Because this value is not calculated until `postUpdate`, you must listen for it
* during a Scene `POST_UPDATE` or `RENDER` event, and not in `update`, as it will
* not be calculated by that point. If you _do_ use these values in `update` they
* will represent the delta from the _previous_ game frame.
*
* Returns the final delta y value.
*/
deltaYFinal(): number;
/**
* The change in this Body's rotation from the previous step, in degrees.
*
* Returns the delta value.
*/
deltaZ(): number;
/**
* Disables this Body and marks it for deletion by the simulation.
*
* @method Phaser.Physics.Arcade.Body#destroy
* @since 3.0.0
*/
destroy(): void;
/**
* Draws this Body and its velocity, if enabled.
*
* @method Phaser.Physics.Arcade.Body#drawDebug
* @since 3.0.0
*
* @param {CanvasRenderingContext2D} Context2D - The Context2D to draw on.
*/
drawDebug(ctx: CanvasRenderingContext2D): void;
/**
* Whether this Body will be drawn to the debug display.
*
* @method Phaser.Physics.Arcade.Body#willDrawDebug
* @since 3.0.0
*
* @return {boolean} True if either `debugShowBody` or `debugShowVelocity` are enabled.
*/
willDrawDebug(): boolean;
/**
* Sets whether this Body collides with the world boundary.
*
* Optionally also sets the World Bounce and `onWorldBounds` values.
*
* @method Phaser.Physics.Arcade.Body#setCollideWorldBounds
* @since 3.0.0
*
* @param {boolean} [value=true] - `true` if the Body should collide with the world bounds, otherwise `false`.
* @param {number} [bounceX] - If given this replaces the Body's `worldBounce.x` value.
* @param {number} [bounceY] - If given this replaces the Body's `worldBounce.y` value.
* @param {boolean} [onWorldBounds] - If given this replaces the Body's `onWorldBounds` value.
*
* @return {Phaser.Physics.Arcade.Body} This Body object.
*/
setCollideWorldBounds(value: any, bounceX: any, bounceY: any, onWorldBounds: any): this;
/**
* Sets the Body's velocity.
*
* @method Phaser.Physics.Arcade.Body#setVelocity
* @since 3.0.0
*
* @param {number} x - The horizontal velocity, in pixels per second.
* @param {number} [y=x] - The vertical velocity, in pixels per second.
*
* @return {Phaser.Physics.Arcade.Body} This Body object.
*/
setVelocity(x: any, y: any): this;
/**
* Sets the Body's horizontal velocity.
*
* @method Phaser.Physics.Arcade.Body#setVelocityX
* @since 3.0.0
*
* @param {number} value - The velocity, in pixels per second.
*
* @return {Phaser.Physics.Arcade.Body} This Body object.
*/
setVelocityX(value: any): this;
/**
* Sets the Body's vertical velocity.
*
* @method Phaser.Physics.Arcade.Body#setVelocityY
* @since 3.0.0
*
* @param {number} value - The velocity, in pixels per second.
*
* @return {Phaser.Physics.Arcade.Body} This Body object.
*/
setVelocityY(value: any): this;
/**
* Sets the Body's maximum velocity.
*
* @method Phaser.Physics.Arcade.Body#setMaxVelocity
* @since 3.10.0
*
* @param {number} x - The horizontal velocity, in pixels per second.
* @param {number} [y=x] - The vertical velocity, in pixels per second.
*
* @return {Phaser.Physics.Arcade.Body} This Body object.
*/
setMaxVelocity(x: any, y: any): this;
/**
* Sets the Body's maximum horizontal velocity.
*
* @method Phaser.Physics.Arcade.Body#setMaxVelocityX
* @since 3.50.0
*
* @param {number} value - The maximum horizontal velocity, in pixels per second.
*
* @return {Phaser.Physics.Arcade.Body} This Body object.
*/
setMaxVelocityX(value: any): this;
/**
* Sets the Body's maximum vertical velocity.
*
* @method Phaser.Physics.Arcade.Body#setMaxVelocityY
* @since 3.50.0
*
* @param {number} value - The maximum vertical velocity, in pixels per second.
*
* @return {Phaser.Physics.Arcade.Body} This Body object.
*/
setMaxVelocityY(value: any): this;
/**
* Sets the maximum speed the Body can move.
*
* @method Phaser.Physics.Arcade.Body#setMaxSpeed
* @since 3.16.0
*
* @param {number} value - The maximum speed value, in pixels per second. Set to a negative value to disable.
*
* @return {Phaser.Physics.Arcade.Body} This Body object.
*/
setMaxSpeed(value: any): this;
/**
* Sets the Body's bounce.
*
* @method Phaser.Physics.Arcade.Body#setBounce
* @since 3.0.0
*
* @param {number} x - The horizontal bounce, relative to 1.
* @param {number} y - The vertical bounce, relative to 1.
*
* @return {Phaser.Physics.Arcade.Body} This Body object.
*/
setBounce(x: any, y: any): this;
/**
* Sets the Body's horizontal bounce.
*
* @method Phaser.Physics.Arcade.Body#setBounceX
* @since 3.0.0
*
* @param {number} value - The bounce, relative to 1.
*
* @return {Phaser.Physics.Arcade.Body} This Body object.
*/
setBounceX(value: any): this;
/**
* Sets the Body's vertical bounce.
*
* @method Phaser.Physics.Arcade.Body#setBounceY
* @since 3.0.0
*
* @param {number} value - The bounce, relative to 1.
*
* @return {Phaser.Physics.Arcade.Body} This Body object.
*/
setBounceY(value: any): this;
/**
* Sets the Body's acceleration.
*
* @method Phaser.Physics.Arcade.Body#setAcceleration
* @since 3.0.0
*
* @param {number} x - The horizontal component, in pixels per second squared.
* @param {number} y - The vertical component, in pixels per second squared.
*
* @return {Phaser.Physics.Arcade.Body} This Body object.
*/
setAcceleration(x: any, y: any): this;
/**
* Sets the Body's horizontal acceleration.
*
* @method Phaser.Physics.Arcade.Body#setAccelerationX
* @since 3.0.0
*
* @param {number} value - The acceleration, in pixels per second squared.
*
* @return {Phaser.Physics.Arcade.Body} This Body object.
*/
setAccelerationX(value: any): this;
/**
* Sets the Body's vertical acceleration.
*
* @method Phaser.Physics.Arcade.Body#setAccelerationY
* @since 3.0.0
*
* @param {number} value - The acceleration, in pixels per second squared.
*
* @return {Phaser.Physics.Arcade.Body} This Body object.
*/
setAccelerationY(value: any): this;
/**
* Enables or disables drag.
*
* @method Phaser.Physics.Arcade.Body#setAllowDrag
* @since 3.9.0
* @see Phaser.Physics.Arcade.Body#allowDrag
*
* @param {boolean} [value=true] - `true` to allow drag on this body, or `false` to disable it.
*
* @return {Phaser.Physics.Arcade.Body} This Body object.
*/
setAllowDrag(value: any): this;
/**
* Enables or disables gravity's effect on this Body.
*
* @method Phaser.Physics.Arcade.Body#setAllowGravity
* @since 3.9.0
* @see Phaser.Physics.Arcade.Body#allowGravity
*
* @param {boolean} [value=true] - `true` to allow gravity on this body, or `false` to disable it.
*
* @return {Phaser.Physics.Arcade.Body} This Body object.
*/
setAllowGravity(value: any): this;
/**
* Enables or disables rotation.
*
* @method Phaser.Physics.Arcade.Body#setAllowRotation
* @since 3.9.0
* @see Phaser.Physics.Arcade.Body#allowRotation
*
* @param {boolean} [value=true] - `true` to allow rotation on this body, or `false` to disable it.
*
* @return {Phaser.Physics.Arcade.Body} This Body object.
*/
setAllowRotation(value: any): this;
/**
* Sets the Body's drag.
*
* @method Phaser.Physics.Arcade.Body#setDrag
* @since 3.0.0
*
* @param {number} x - The horizontal component, in pixels per second squared.
* @param {number} y - The vertical component, in pixels per second squared.
*
* @return {Phaser.Physics.Arcade.Body} This Body object.
*/
setDrag(x: any, y: any): this;
/**
* If this Body is using `drag` for deceleration this property controls how the drag is applied.
* If set to `true` drag will use a damping effect rather than a linear approach. If you are
* creating a game where the Body moves freely at any angle (i.e. like the way the ship moves in
* the game Asteroids) then you will get a far smoother and more visually correct deceleration
* by using damping, avoiding the axis-drift that is prone with linear deceleration.
*
* If you enable this property then you should use far smaller `drag` values than with linear, as
* they are used as a multiplier on the velocity. Values such as 0.95 will give a nice slow
* deceleration, where-as smaller values, such as 0.5 will stop an object almost immediately.
*
* @method Phaser.Physics.Arcade.Body#setDamping
* @since 3.50.0
*
* @param {boolean} value - `true` to use damping, or `false` to use drag.
*
* @return {Phaser.Physics.Arcade.Body} This Body object.
*/
setDamping(value: any): this;
/**
* Sets the Body's horizontal drag.
*
* @method Phaser.Physics.Arcade.Body#setDragX
* @since 3.0.0
*
* @param {number} value - The drag, in pixels per second squared.
*
* @return {Phaser.Physics.Arcade.Body} This Body object.
*/
setDragX(value: any): this;
/**
* Sets the Body's vertical drag.
*
* @method Phaser.Physics.Arcade.Body#setDragY
* @since 3.0.0
*
* @param {number} value - The drag, in pixels per second squared.
*
* @return {Phaser.Physics.Arcade.Body} This Body object.
*/
setDragY(value: any): this;
/**
* Sets the Body's gravity.
*
* @method Phaser.Physics.Arcade.Body#setGravity
* @since 3.0.0
*
* @param {number} x - The horizontal component, in pixels per second squared.
* @param {number} y - The vertical component, in pixels per second squared.
*
* @return {Phaser.Physics.Arcade.Body} This Body object.
*/
setGravity(x: any, y: any): this;
/**
* Sets the Body's horizontal gravity.
*
* @method Phaser.Physics.Arcade.Body#setGravityX
* @since 3.0.0
*
* @param {number} value - The gravity, in pixels per second squared.
*
* @return {Phaser.Physics.Arcade.Body} This Body object.
*/
setGravityX(value: any): this;
/**
* Sets the Body's vertical gravity.
*
* @method Phaser.Physics.Arcade.Body#setGravityY
* @since 3.0.0
*
* @param {number} value - The gravity, in pixels per second squared.
*
* @return {Phaser.Physics.Arcade.Body} This Body object.
*/
setGravityY(value: any): this;
/**
* Sets the Body's friction.
*
* @method Phaser.Physics.Arcade.Body#setFriction
* @since 3.0.0
*
* @param {number} x - The horizontal component, relative to 1.
* @param {number} y - The vertical component, relative to 1.
*
* @return {Phaser.Physics.Arcade.Body} This Body object.
*/
setFriction(x: any, y: any): this;
/**
* Sets the Body's horizontal friction.
*
* @method Phaser.Physics.Arcade.Body#setFrictionX
* @since 3.0.0
*
* @param {number} value - The friction value, relative to 1.
*
* @return {Phaser.Physics.Arcade.Body} This Body object.
*/
setFrictionX(value: any): this;
/**
* Sets the Body's vertical friction.
*
* @method Phaser.Physics.Arcade.Body#setFrictionY
* @since 3.0.0
*
* @param {number} value - The friction value, relative to 1.
*
* @return {Phaser.Physics.Arcade.Body} This Body object.
*/
setFrictionY(value: any): this;
/**
* Sets the Body's angular velocity.
*
* @method Phaser.Physics.Arcade.Body#setAngularVelocity
* @since 3.0.0
*
* @param {number} value - The velocity, in degrees per second.
*
* @return {Phaser.Physics.Arcade.Body} This Body object.
*/
setAngularVelocity(value: any): this;
/**
* Sets the Body's angular acceleration.
*
* @method Phaser.Physics.Arcade.Body#setAngularAcceleration
* @since 3.0.0
*
* @param {number} value - The acceleration, in degrees per second squared.
*
* @return {Phaser.Physics.Arcade.Body} This Body object.
*/
setAngularAcceleration(value: any): this;
/**
* Sets the Body's angular drag.
*
* @method Phaser.Physics.Arcade.Body#setAngularDrag
* @since 3.0.0
*
* @param {number} value - The drag, in degrees per second squared.
*
* @return {Phaser.Physics.Arcade.Body} This Body object.
*/
setAngularDrag(value: any): this;
/**
* Sets the Body's mass.
*
* @method Phaser.Physics.Arcade.Body#setMass
* @since 3.0.0
*
* @param {number} value - The mass value, relative to 1.
*
* @return {Phaser.Physics.Arcade.Body} This Body object.
*/
setMass(value: any): this;
/**
* Sets the Body's `immovable` property.
*
* @method Phaser.Physics.Arcade.Body#setImmovable
* @since 3.0.0
*
* @param {boolean} [value=true] - The value to assign to `immovable`.
*
* @return {Phaser.Physics.Arcade.Body} This Body object.
*/
setImmovable(value: any): this;
/**
* Sets the Body's `enable` property.
*
* @method Phaser.Physics.Arcade.Body#setEnable
* @since 3.15.0
*
* @param {boolean} [value=true] - The value to assign to `enable`.
*
* @return {Phaser.Physics.Arcade.Body} This Body object.
*/
setEnable(value: any): this;
/**
* This is an internal handler, called by the `ProcessX` function as part
* of the collision step. You should almost never call this directly.
*
* @method Phaser.Physics.Arcade.Body#processX
* @since 3.50.0
*
* @param {number} x - The amount to add to the Body position.
* @param {number} [vx] - The amount to add to the Body velocity.
* @param {boolean} [left] - Set the blocked.left value?
* @param {boolean} [right] - Set the blocked.right value?
*/
processX(x: any, vx: any, left: any, right: any): void;
/**
* This is an internal handler, called by the `ProcessY` function as part
* of the collision step. You should almost never call this directly.
*
* @method Phaser.Physics.Arcade.Body#processY
* @since 3.50.0
*
* @param {number} y - The amount to add to the Body position.
* @param {number} [vy] - The amount to add to the Body velocity.
* @param {boolean} [up] - Set the blocked.up value?
* @param {boolean} [down] - Set the blocked.down value?
*/
processY(y: any, vy: any, up: any, down: any): void;
/**
* The Bodys horizontal position (left edge).
*
* @name Phaser.Physics.Arcade.Body#x
* @type {number}
* @since 3.0.0
*/
get x(): number;
set x(value: number);
/**
* The Bodys vertical position (top edge).
*
* @name Phaser.Physics.Arcade.Body#y
* @type {number}
* @since 3.0.0
*/
get y(): number;
set y(value: number);
/**
* The left edge of the Body. Identical to x.
*
* @name Phaser.Physics.Arcade.Body#left
* @type {number}
* @readonly
* @since 3.0.0
*/
get left(): number;
/**
* The right edge of the Body.
*
* @name Phaser.Physics.Arcade.Body#right
* @type {number}
* @readonly
* @since 3.0.0
*/
get right(): number;
/**
* The top edge of the Body. Identical to y.
*
* @name Phaser.Physics.Arcade.Body#top
* @type {number}
* @readonly
* @since 3.0.0
*/
get top(): number;
/**
* The bottom edge of this Body.
*
* @name Phaser.Physics.Arcade.Body#bottom
* @type {number}
* @readonly
* @since 3.0.0
*/
get bottom(): number;
}
//# sourceMappingURL=Body.d.ts.map