Hierarchy

Constructors

  • Voxel Physics Engine

    Models a world of rigid bodies, to be integrated against solid or liquid voxel terrain.

    Takes testSolid(x,y,z) function to query block solidity Takes testFluid(x,y,z) function to query if a block is a fluid

    The options argument can take the following params:

    {
    airDrag: 0.1,
    fluidDrag: 0.4,
    fluidDensity: 2.0,
    gravity: [0, -10, 0],
    minBounceImpulse: .5, // lowest collision impulse that bounces
    }

    Parameters

    • opts: any
    • testSolid: ((x, y, z) => boolean)
        • (x, y, z): boolean
        • Parameters

          • x: number
          • y: number
          • z: number

          Returns boolean

    • testFluid: ((x, y, z) => boolean)
        • (x, y, z): boolean
        • Parameters

          • x: number
          • y: number
          • z: number

          Returns boolean

    Returns Physics

Properties

airDrag: any
bodies: any[]
fluidDensity: any
fluidDrag: any
gravity: any
minBounceImpulse: any
testFluid: ((x, y, z) => boolean)

Type declaration

    • (x, y, z): boolean
    • Parameters

      • x: number
      • y: number
      • z: number

      Returns boolean

testSolid: ((x, y, z) => boolean)

Type declaration

    • (x, y, z): boolean
    • Parameters

      • x: number
      • y: number
      • z: number

      Returns boolean

Methods

  • Adds a physics body to the simulation

    Parameters

    • _aabb: any
    • mass: any
    • friction: any
    • restitution: any
    • gravMult: any
    • onCollide: any

    Returns RigidBody

  • Removes a body, by direct reference

    Parameters

    • b: any

    Returns any

  • Parameters

    • dt: any

    Returns void

Generated using TypeDoc