Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PhysicsSystem2D

Hierarchy

  • any
    • PhysicsSystem2D

Index

Constructors

Private constructor

Properties

Private _accumulator

_accumulator: number = 0

Private _allowSleep

_allowSleep: boolean = true

Private _autoSimulation

_autoSimulation: boolean = true

Private _delayEvents

_delayEvents: DelayEvent[] = []

Private _enable

_enable: boolean = true

Private _fixedTimeStep

_fixedTimeStep: number = 1.0 / 60.0

Private Readonly _gravity

_gravity: Vec2 = new Vec2(0, -10 * PHYSICS_2D_PTM_RATIO)

Private _maxSubSteps

_maxSubSteps: number = 1

Private _steping

_steping: boolean = false

Readonly collisionMatrix

collisionMatrix: ICollisionMatrix = new CollisionMatrix() as unknown as ICollisionMatrix

Gets the collision matrix。

Readonly physicsWorld

physicsWorld: IPhysicsWorld

Gets the wrappered object of the physical world through which you can access the actual underlying object.

positionIterations

positionIterations: number = 10

The position Iterations for the position constraint solver.

velocityIterations

velocityIterations: number = 10

The velocity iterations for the velocity constraint solver.

Static Readonly ID

ID: "PHYSICS_2D" = "PHYSICS_2D"

Gets the ID of the system.

Accessors

allowSleep

  • get allowSleep(): boolean
  • set allowSleep(v: boolean): void
  • zh

    获取或设置物理系统是否允许自动休眠,默认为 true。

    zh

    获取或设置物理系统是否允许自动休眠,默认为 true。

    Returns boolean

  • zh

    获取或设置物理系统是否允许自动休眠,默认为 true。

    zh

    获取或设置物理系统是否允许自动休眠,默认为 true。

    Parameters

    • v: boolean

    Returns void

autoSimulation

  • get autoSimulation(): boolean
  • set autoSimulation(value: boolean): void

debugDrawFlags

  • get debugDrawFlags(): number
  • set debugDrawFlags(v: number): void

enable

  • get enable(): boolean
  • set enable(value: boolean): void

fixedTimeStep

  • get fixedTimeStep(): number
  • set fixedTimeStep(value: number): void

gravity

  • get gravity(): Vec2
  • set gravity(gravity: Vec2): void

maxSubSteps

  • get maxSubSteps(): number
  • set maxSubSteps(value: number): void

stepping

  • get stepping(): boolean

Static PHYSICSBOX2D

  • get PHYSICSBOX2D(): boolean

Static PHYSICSBUILTIN

  • get PHYSICSBUILTIN(): boolean

Static PHYSICSNONE

  • get PHYSICSNONE(): boolean

Static instance

Methods

callAfterStep

  • callAfterStep(target: object, func: Function): void

postUpdate

  • postUpdate(deltaTime: number): void
  • Perform a simulation of the physics system, which will now be performed automatically on each frame.

    Parameters

    • deltaTime: number

      与上一次执行相差的时间,目前为每帧消耗时间

    Returns void

raycast

  • Raycast the world for all colliders in the path of the ray. The raycast ignores colliders that contain the starting point.

    method

    rayCast

    Parameters

    • p1: IVec2Like

      start point of the raycast

    • p2: IVec2Like

      end point of the raycast

    • Default value type: ERaycast2DType = ERaycast2DType.Closest

      optional, default is RayCastType.Closest

    • Default value mask: number = 4294967295

      optional, default is 0xffffffff

    Returns keyof Readonly<RaycastResult2D>[]

resetAccumulator

  • resetAccumulator(time?: number): void

step

  • step(fixedTimeStep: number): void

testAABB

testPoint

Generated using TypeDoc